-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect warning regarding "default" conditional export #3887
Comments
The Node.js documentation also said:
The matching algorithm should test conditions from top to bottom, until some case matches. Since there's only 2 importing style in JavaScript (require or import), they must at least much one. Thus the |
Based on reviewing the code in that change further and your comment @hyrious , I am going to close this. I'm worried there may be some weird tool in our toolchain that doesn't work as one would hope, and that default is needed in that case, but I don't have a specific situation right now. |
I'm reopening this as I agree that this warning shouldn't trigger for |
I'm also seeing this warning for several of my projects that are set up like this: "exports": {
"import": "./thing.mjs",
"require": "./thing.cjs",
"*": "./*"
}, I've used this (this might not be best practice though) |
Sorry, I'm confused. How would that work? In the example you gave, that import is a module instantiation error. Running that example in node gives the following error:
|
With the change introduced for this issue, #3867, we are now seeing the following error from esbuild:
The
package.json
in this case has these conditional exports:According to the NodeJS documentation, it appears
default
should always be last, so this warning feels incorrect?The text was updated successfully, but these errors were encountered: