VUE3.X版本error: Parsing error: Parsing error: Unexpected token 的解决办法


例如如下错误:其实与代码无关

 error  in ./src/App.vue

Module Error (from ./node_modules/eslint-loader/index.js):

D:\workspace\test\element-plus-test\src\App.vue
  1:1  error  Parsing error: Unexpected token <1 problem (1 error, 0 warnings)

解决办法:

1. 安装eslint-plugin-vue插件

 npm install eslint-plugin-vue -D

2.在.eslint.js配置文件中添加如下配置:

module.exports = {
  root: true,
  parserOptions: {
    "ecmaVersion": 7,
    sourceType: 'module'
  },
  "parser": "vue-eslint-parser",   // 添加这一句
  rules: {
    "@typescript-eslint/explicit-module-boundary-types":"off"
  }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM