安装 eslint-import-resolver-webpack
yarn add eslint-import-resolver-webpack
在.eslintrc.js中加入
settings: {
'import/resolver': {
webpack: {
config: 'node_modules/@vue/cli-service/webpack.config.js',
},
},
},
rules: {
'import/extensions': ['error', 'always', {
'js': 'never',
'vue': 'never'
}]
},