-
-
Notifications
You must be signed in to change notification settings - Fork 110
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
package.json is missing main
field
#552
Comments
This should be raised at eslint. exports map has a higher priority than main, in fact it means that main must be ignored. Typescript has it's own Sorry if this sounds harsh but the whole "main vs module vs browser vs whatever" top level resolve hint field debacle is only going to get worse if people start adding exports maps to the mix instead of replacing the older fields. We kept main until we were dropping our commonjs output for backwards compatibility. For all node versions we support, exports maps is supported, so use that. |
That's disappointing. It feels like you're intentionally causing pain to developers like me for purely philosophical reasons. And for what it's worth, the eslint issue has been open for a long time. It's not a simple matter to just fix it. import-js/eslint-plugin-import#2132 |
There is no pain, you can easily change your eslint config to ignore this rule for vite-plugin-svelte, or add a comment to ignore it above the import or contribute a fix to the eslint rule. Tools to resolve exports map exist: https://github.com/lukeed/resolve.exports |
Describe the bug
Not all tooling supports the package.json
exports
field, including TypeScript when running withmoduleResolution: node
(which is the case for most apps using a bundler). Is there a reason not to include amain
field to improve compatibility with existing tooling?In my particular case, I'm having trouble with eslint's
import/no-extraneous
rule. It does not think the plugin is installed, but it is.Reproduction URL
https://stackblitz.com/edit/vitejs-vite-yb9bgt?file=src%2Fexample.js&terminal=lint
Reproduction
Check the example, eslint throws an error. If you add a
main
to the package.json, the error disappears.Logs
No response
System Info
The text was updated successfully, but these errors were encountered: