Babel-loader正在尝试使用预设阶段2,而babelrc中甚至都没有提到

时间:2019-05-06 08:00:42

标签: node.js webpack babeljs

当我运行Webpack时,它说:

odule build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /var/www/VueFrontEnd/node_modules/babel-preset-stage-2/lib/index.js

虽然我已经运行npx babel-upgrade --write,但这是我的babelrc:

{
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    [
      "@babel/plugin-transform-runtime",
      {
        "corejs": 2
      }
    ],
    "@babel/plugin-syntax-dynamic-import",
    "@babel/plugin-syntax-import-meta",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-json-strings",
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    "@babel/plugin-proposal-function-sent",
    "@babel/plugin-proposal-export-namespace-from",
    "@babel/plugin-proposal-numeric-separator",
    "@babel/plugin-proposal-throw-expressions"
  ],
  "comments": false
}

可能是什么问题?

背景:我正试图从Webpack 2升级到Webpack 4,但我遇到了很多问题,包括这个问题。

0 个答案:

没有答案