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

import/no-unresolvedandimport/extensions showed up when I gave a settings on .eslintrc #2628

Closed
fengxinming opened this issue Sep 27, 2018 · 7 comments

Comments

@fengxinming
Copy link

Version

3.0.4

Reproduction link

https://github.com/fengxinming/vuecli3-demo

Node and OS info

node: v8.11.1, npm: 6.4.1, OS: MacOS10.13.5

Steps to reproduce

npm i
npm run build

What is expected?

no warnings showed up

What is actually happening?

/Users/jesse/workspace/vuecli3-demo/src/main.js
2:17 error Unable to resolve path to module '@/App.vue' import/no-unresolved
3:20 error Unable to resolve path to module '@/router' import/no-unresolved
3:20 error Missing file extension for "@/router" import/extensions
4:19 error Unable to resolve path to module '@/store' import/no-unresolved
4:19 error Missing file extension for "@/store" import/extensions
5:8 error Unable to resolve path to module '@/registerServiceWorker' import/no-unresolved
5:8 error Missing file extension for "@/registerServiceWorker" import/extensions

✖ 7 problems (7 errors, 0 warnings)


I have provided a demo on github, you may check the link

@haoqunjiang
Copy link
Member

Use the webpack config exported by @vue/cli-service (which will load config from vue.config.js) instead of directly requiring vue.config.js.

settings: {
'import/resolver': {
webpack: {
config: require.resolve('@vue/cli-service/webpack.config.js')
}
},

@fengxinming
Copy link
Author

@sodatea It still can not resolve my issues

@fengxinming
Copy link
Author

@sodatea

I have provided a demo, did you check it?

[eslint] Unable to resolve path to module '@/registerServiceWorker'. (import/no-unresolved)
[eslint] Missing file extension for "@/registerServiceWorker" (import/extensions)

@haoqunjiang
Copy link
Member

@fengxinming
Copy link
Author

@sodatea but the codes in my vscode, it still shows red underline

@haoqunjiang
Copy link
Member

Then it's a vscode issue.
Possible related:
#2546
microsoft/vscode-eslint#405

@Ross-Hunter
Copy link

#2628 (comment) in combination with installing eslint-import-resolver-webpack worked for me.

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