Parsing error: Unexpected token import at src\router\index.js:25:24:

vue cil4.x 报错如下:
在这里插入图片描述
原因:缺少依赖 eslint-plugin-vue
解决方案:

  1. 执行npm i eslint-plugin-vue -D下载依赖
  2. 配置.eslintrc.js文件 ,如果没有可以创建
    .eslintrc.js配置如下:
module.exports = {
  rules: {
    'no-console': 'off',
    "parser": "vue-eslint-parser"
  },
  parserOptions: {
    "ecmaVersion": 7,
    "sourceType": "module"
  }
}

猜你喜欢

转载自blog.csdn.net/weixin_41377835/article/details/106208899