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

eslint import/no-unresolved; Unable to resolve path to module 'virtual:generated-pages' #41

Closed
MartinMa opened this issue Apr 21, 2021 · 3 comments

Comments

@MartinMa
Copy link
Contributor

ESLint complains about the line import generatedRoutes from 'virtual:generated-pages'; with Unable to resolve path to module 'virtual:generated-pages'.

Any idea how I can make the linter happy?

I can only think of this:

// eslint-disable-next-line import/no-unresolved
import generatedRoutes from 'virtual:generated-pages';

Thanks.

@hannoeru
Copy link
Owner

Because it's a virtual module witch is not exits in file system, simply disable this rule, it will be fine.

@MartinMa
Copy link
Contributor Author

Thanks, I disabled import/no-unresolved in .eslintrc.js for my project. Apart from that I noticed that tsc checks for problems with module resolutions as well and displays errors directly in the IDE of VS Code. So I will still catch this kind of errors.

@dhruvkb
Copy link

dhruvkb commented Jan 5, 2023

Instead of disabling the rule entirely, I found that ignoring the rule for virtual paths is also viable.

// .eslintrc.js
module.exports = {
  // other config
  rules: {
    'import/no-unresolved': ['error', { ignore: ['^virtual:'] }],
  },
}

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

No branches or pull requests

3 participants