vue eslint报错Unexpected token import解决

vue项目执行 npm run serve 启动时报以下错误(实际错误很多,仅复制两个)

 error  in ./src/router/index.js

Module Error (from ./node_modules/eslint-loader/index.js):
error: Parsing error: Unexpected token import at src\router\index.js:11:26:
   9 |         path: '/',
  10 |         name: 'home',
> 11 |         component: () => import('@/views/home/Index'),
     |                          ^
  12 |         redirect: '/subscribe',
  13 |         children: [
  14 |             {


1 error found.

 error  in ./src/mixins/logoTitle.js

Module Error (from ./node_modules/eslint-loader/index.js):
error: Parsing error: Unexpected token getLogoTitle at src\mixins\logoTitle.js:3:15:
  1 | export default {
  2 |     methods: {
> 3 |         async getLogoTitle() {
    |               ^
  4 |             this.setLogoAndTitle(this.$localstore.get('logoTitle'));
  5 |             await this.setLogoTitle();
  6 |         },


1 error found.

原因是eslint校验代码时babel还未处理代码,
在.eslintrc.js中 extends: [], 删掉所有,只保留'plugin:vue/essential' 一项

你可能感兴趣的:(vue eslint报错Unexpected token import解决)