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