vue-cli 依赖升级后就运行就报 "jsx", "flow", "typescript".错误, 这种情况要怎么解决?

"devDependencies": {
"@babel/core": "^7.16.12",
"@babel/eslint-parser": "^7.16.5",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@umijs/fabric": "^2.10.1",
"@vue/cli-plugin-babel": "^5.0.0",
"@vue/cli-plugin-eslint": "^5.0.0",
"@vue/cli-plugin-pwa": "^5.0.0",
"@vue/cli-plugin-router": "^5.0.0",
"@vue/cli-plugin-vuex": "^5.0.0",
"@vue/cli-service": "^5.0.0",
"@vue/compiler-sfc": "~3.2.29",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-plugin-import": "^1.13.3",
"eslint": "^7.20.0",
"eslint-plugin-linestyle": "^1.0.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-vue": "^7.20.0",
"less": "^4.0.0",
"less-loader": "^6.2.0",
"lint-staged": "^12.3.1",
"prettier": "^2.5.1",
"style-resources-loader": "^1.5.0",
"vue-cli-plugin-style-resources-loader": "^0.1.5"
}

.eslintrc.js

  {
root: true,
  env: {
  browser: true,
  es2021: true,
},
extends: ["plugin:vue/vue3-essential", "eslint:recommended", "@vue/prettier"],
// parser: '@babel/eslint-parser',
parserOptions: {
  ecmaVersion: 12,
  parser: "@babel/eslint-parser",
  requireConfigFile: false,
  sourceType: "module",
  allowImportExportEverywhere: true,
  ecmaFeatures: {
    jsx: true,
  },
},
}

我重新拉取项目依赖后就报

ERROR in ./src/views/table/index.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/views/table/index.vue?vue&type=script&lang=js)
Module Error (from ./node_modules/vue-loader/dist/index.js):
[vue/compiler-sfc] This experimental syntax requires enabling one of the following parser plugin(s): "jsx", "flow", "typescript". (37:12)

网上的修改方法都试过,都不行,不知道有没有什么好的解决方法

阅读 6.8k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏