-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
import/no-unresolved is not recognizing installed modules that export "." #2703
Comments
Do the package.json files have an "export" key to map exports to file names? |
// /node_modules/@vue/test-utils/package.json
...
"main": "dist/vue-test-utils.js",
"module": "dist/vue-test-utils.esm.js",
"exports": {
".": {
"default": "./dist/vue-test-utils.js",
"require": "./dist/vue-test-utils.js",
"import": "./dist/vue-test-utils.esm.js"
}
},
... // /node_modules/vuex/package.json
...
"main": "dist/vuex.common.js",
"module": "dist/vuex.esm.js",
"exports": {
".": {
"module": "./dist/vuex.esm.js",
"require": "./dist/vuex.common.js",
"import": "./dist/vuex.mjs"
},
"./": "./"
},
... // /node_modules/axios/package.json
...
"main": "index.js",
... // /node_modules/flush-promises/package.json
...
"main": "index.js",
... The |
hey, I'm running into the same issue while importing the issue may comes from nested export of this syntax look good according to nodejs doc https://nodejs.org/docs/latest-v16.x/api/packages.html#package-entry-points but is no resolved by |
Updated issue title based on this new information. |
Do they have a "main", though? This plugin uses |
Updated previous example to answer question |
Thank you for the head up @ljharb |
…package.json exports See: import-js/eslint-plugin-import#2703
issue occurs also with avajs |
This issue also occurs with react-hook-form, which does have a
I can resolve the issue by changing the react-hook-form package.json from
to
Of course, this isn't a real solution, but seems to indicate that it's specifically the conditional exports syntax that is a problem for the resolver |
👋 Just noting that I ran into this with
|
Also happening with solid-js |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Yeah it's the missing |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I have the same issue with @nats-io/nats-core: From their package.json: "name": "@nats-io/nats-core",
"version": "3.0.0-30",
"files": [
"lib/",
"LICENSE",
"README.md"
],
"types": "./lib/mod.d.js",
"exports": {
".": "./lib/mod.js",
"./internal": "./lib/internal_mod.js"
}, |
Would switching to using this library for resolving imports/exports be possible?
It could even be used as a fallback from what you are currently doing, so it is only called if the current checks failed before reporting an error. |
@TheJaredWilcurt unfortunately no, because it's not actually correct - there's at least 6 different permutations of the |
Is there any downside to supporting all of them? That seems like the clear choice, since we can't control which approach libraries choose. |
They're contradictory. A library would have to allow the node version, and thus the algorithm, to be configurable per invocation, which is what |
All dependencies are on their latest versions.
Errors:
Code:
vuex
is in thedependencies
and@vue/test-utils
is in thedevDependencies
inpackage.json
. Both are installed and in thenode_modules
folder.What's interesting is that they fail across all test files, but no other
node_module
imports fail. It's just these two.eslintrc.js
tjw-import
can be seen here:The text was updated successfully, but these errors were encountered: