vue-cli3.0 配置babel.config.js的时候,总是报错..Unknown option

  • vue-cli3.0 配置babel.config.js的时候,总是报错..ReferenceError: Unknown option
Failed to compile.

./src/router.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
ReferenceError: Unknown option: .chainWebpack. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.
    at throwUnknownError (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\validation\options.js:123:11)
    at Object.keys.forEach.key (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\validation\options.js:107:5)
    at Array.forEach (<anonymous>)
    at validateNested (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\validation\options.js:83:21)
    at validate (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\validation\options.js:74:10)
    at file (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\config-chain.js:169:34)
    at cachedFunction (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\caching.js:33:19)
    at buildRootChain (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\config-chain.js:89:27)
    at loadPrivatePartialConfig (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\partial.js:85:55)
    at Object.loadPartialConfig (C:\Users\Administrator\Desktop\pbb\app\node_modules\@babel\core\lib\config\partial.js:110:18)
    at Object.<anonymous> (C:\Users\Administrator\Desktop\pbb\app\node_modules\babel-loader\lib\index.js:144:26)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (C:\Users\Administrator\Desktop\pbb\app\node_modules\babel-loader\lib\index.js:3:103)
    at _next (C:\Users\Administrator\Desktop\pbb\app\node_modules\babel-loader\lib\index.js:5:194)
    at C:\Users\Administrator\Desktop\pbb\app\node_modules\babel-loader\lib\index.js:5:364
    at new Promise (<anonymous>)

package.json

{
  "name": "app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^2.6.5",
    "vant": "^1.6.20",
    "vue": "^2.6.10",
    "vue-router": "^3.0.3",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@vue/cli-plugin-babel": "^3.8.0",
    "@vue/cli-plugin-eslint": "^3.8.0",
    "@vue/cli-service": "^3.8.0",
    "@vue/eslint-config-standard": "^4.0.0",
    "babel-eslint": "^10.0.1",
    "babel-plugin-import": "^1.11.2",
    "babel-polyfill": "^6.26.0",
    "es6-promise": "^4.2.6",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "less": "^3.0.4",
    "less-loader": "^4.1.0",
    "vue-template-compiler": "^2.6.10"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "@vue/standard"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}
  • 请问各路大神,这个要怎么解决?
阅读 21.9k
2 个回答

我写错地方了!!
应该写在vue.config.js我写在了babel.config.js里了...
果然还是得 脑袋清醒的时候写代码.

新手上路,请多包涵

vue cli3 配置babel.config.js之后运行编译出现了这个错误,楼主是怎么解决的这个错误啊

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