-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The files specified in module
and exports
are mismatched.
#155
Comments
@mshrtsr until this or the fix for the vite issue gets released, did you figure out a workaround? I just ran into this aswell. |
@MrMadClown |
Thanks mshrtsr I think you are right about the "modules" field being incorrect. I haven't been able to reproduce what you saw, I think because the precedence order has been fixed in
Adding your |
@shadowspawn |
Thanks @mshrtsr! With node v18.13.0 and the |
Hi there, and thanks for the great package.
I encountered following unexpected behavior.
Environment
Summary
In the
package.json
, the files specified inmodule
andexports
are mismatched.exports
,import("y18n")
refers./index.mjs
of y18n.module
,import("y18n")
refers./build/lib/index.js
of y18n.As a result, some bundler which doesn't support the
exports
field fails to build with yargs as a dependency.That's because yargs uses the default export of y18n on
lib/platform-shims/esm.mjs
,and
./build/lib/index.js
on y18n doesn't provide the default export.Reproduction
I created the minimum reproduction in https://github.com/tasshi-playground/repro-y18n-default-export-broken .
$ git clone git@github.com:tasshi-playground/repro-y18n-default-export-broken $ cd repro-y18n-default-export-broken $ npm install $ npm run build
I examined rollup.js and Vite.
rollup supports
exports
of package.json, and Vite doesn't support due to the bug of vitejs/vite#11676 .node_modules/y18n/index.mjs
viaexports
.node_modules/y18n/build/lib/index.js
viamodule
.Log (click to expand)
rollup.js tried to build the code
import y18n from "y18n"
(succeeded)rollup.js tried to build the code
import { y18n } from "y18n"
(failed)Vite tried to build the code
import y18n from "y18n"
(failed)Vite tried to build the code
import { y18n } from "y18n"
(succeeded)Idea
The file specified in the
module
field should be the same asexports
.The text was updated successfully, but these errors were encountered: