"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)
网上的修改方法都试过,都不行,不知道有没有什么好的解决方法
如果你在
/src/views/table/index.vue
这个组件中使用了jsx
,那么需要<script setup lang="jsx">
这样声明。