[Solved] Vue3.X version error: Parsing error: Parsing error: Unexpected token

For example, the following error: it has nothing to do with the code

 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)

Solution:

1. Install the eslint plugin Vue plug-in

 npm install eslint-plugin-vue -D

2. Add the following configuration in the. Eslint.js configuration file:

module.exports = {
  root: true,
  parserOptions: {
    "ecmaVersion": 7,
    sourceType: 'module'
  },
  "parser": "vue-eslint-parser",   // Add this line
  rules: {
    "@typescript-eslint/explicit-module-boundary-types":"off"
  }
}

Similar Posts: