Skip to content
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

Bug: package.json import results in no-missing-import #285

Closed
1 task
perrin4869 opened this issue Jun 2, 2024 · 5 comments · Fixed by #346
Closed
1 task

Bug: package.json import results in no-missing-import #285

perrin4869 opened this issue Jun 2, 2024 · 5 comments · Fixed by #346
Assignees

Comments

@perrin4869
Copy link

Environment

Node version: 20.14.0
npm version: 10.7.0
ESLint version: 8.57.0
eslint-plugin-n version: >=17.5.0

What rule do you want to report?

n/no-missing-import

Link to Minimal Reproducible Example

dotcore64/chai-ip#242

What did you expect to happen?

When package.json contains:

  "imports": {
    "#is-ip": {
      "node": "net",
      "browser": "is-ip"
    }
  },

and I import { isIP } from "#is-ip", the rule should pass

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

This regression started in 17.5.0, so probably by this PR

@perrin4869 perrin4869 added the bug label Jun 2, 2024
@scagood
Copy link

scagood commented Jun 2, 2024

Thank you for the report, I will look later today!

@scagood scagood self-assigned this Jun 2, 2024
@scagood
Copy link

scagood commented Jun 3, 2024

This looks to be related to these:
webpack/enhanced-resolve#303
webpack/enhanced-resolve#310

I think the simplest solution would be a plugin that resolves the node modules to stubs, but it's a tough one.

@perrin4869
Copy link
Author

Hm... Just curious, those are really old issues, but this regression is very recent?
As for resolving, would this be useful?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta/resolve

@scagood
Copy link

scagood commented Jun 5, 2024

I would love to use import.meta.resolve, but we support node ^18.18.0, in fact, as soon as we can use it, we will use it!

@perrin4869
Copy link
Author

might be worth it to fallback to the polyfill in the meantime? https://github.com/wooorm/import-meta-resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants