Webpack Babel-loader - 预设中不支持

时间:2017-05-04 13:22:34

标签: node.js webpack babeljs

过去2天我一直试图解决以下错误,但无济于事: enter image description here

我尝试使用.babelrc文件,然后决定在webpack配置文件中包含预设。 以下是我在webpack.config.js中的babel-loader配置。

rules: [
    {
      test: /\.js$/,
      exclude: /node_modules/,
      use: [
        {
          loader: 'babel-loader',
          options: {
            babelrc: false,
            cacheDirectory: true,
            presets: ["react", "es2015", "stage-0"]
          },
        },
        {
          loader: 'eslint-loader',
        }
      ],
    }
  ]

以下是我的package.json信息:

  "dependencies": {
    "babel-core": "7.0.0-alpha.9",
    "babel-loader": "7.0.0",
    "babel-polyfill": "7.0.0-alpha.9",
    "babel-preset-es2015": "6.24.1",
    "babel-preset-react": "6.24.1",
    "babel-preset-stage-0": "6.24.1",
    "babel-register": "6.24.1",
    "webpack": "2.4.1",
    "webpack-chunk-hash": "0.4.0",
    "webpack-dev-middleware": "1.10.2",
    "webpack-dev-server": "1.14.1",
    "webpack-hot-middleware": "2.18.0",
   }

如果有任何问题可以解决导致此错误的原因,我们将非常感激。

0 个答案:

没有答案