Conversation
Because of the missing 'main' key the eslint-plugin-import:resolver:node wasn't able to resolve the package as a directory, thus throwing import/unresolved error/warning. Here's the link to the code which is failing: https://github.com/browserify/resolve/blob/fd788d94d037e32d4f4be948e2f7e15f6981f004/lib/sync.js#L180 If main is not set, it defaults to index.js in the package's root folder, you're exporting index.js and declaration in the dist directory thus it's producing an error in the code pointed upper.
|
In ESM packages like this one, the I'm afraid the browserify/resolve package is outdated. They should support Leaving this PR open for now, but will probably close it with |
|
I can't say you are wrong with these assumptions, but I cannot tell that mine are bad. By merging this Pull request you will greatly improve backward compatibility with the various tools used across Node ecosystem. It's fine for me if you decide not to merge these changes, but let me tell you - this is the only package in my rollup configuration throwing the unresolved error due to lack of the "main" definition - check it here In this pull request they're trying to add support for the default node import behavior. I believe I will find a wife sooner than this PR is merged or they do proper code changes, and then the ESLint plugin resolver needs to be updated with these changes. It's a long chain of events. |
Because of the missing 'main' key the eslint-plugin-import:resolver:node cannot resolve the package as a directory, thus throwing import/unresolved error/warning.
Here's the link to the place in code that is failing: https://github.com/browserify/resolve/blob/fd788d94d037e32d4f4be948e2f7e15f6981f004/lib/sync.js#L180
If the main is not set, it defaults to index.js in the package's root folder, you're exporting index.js and declaration in the dist directory thus it's producing an error in the code pointed upper.