簡體   English   中英

錯誤顯示Babel / React(未知選項)

[英]Error Transpiling Babel/React (Unknown Option)

嘗試運行webpack時出現以下錯誤:命令: webpack -d --watch

.babelrc:

{
 "presets" : ["es2015", "react", "stage-2"],
 "plugins" : ["transform-flow-comments"]
}

webpack配置:

var webpack = require('webpack');
var path = require('path');
var FlowBabelWebpackPlugin = require('flow-babel-webpack-plugin');

var config = {
  plugins: [
    new FlowBabelWebpackPlugin(),
  ],
  entry: ['./src/app'],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',

  },
   module : {
    loaders : [
      {
        test: /\.css$/,
        loader: 'style!css?modules',
        include: /flexboxgrid/,
      },
      { 
        test: /\.js$/,
        loaders: ['babel'],
        include: path.join(__dirname, 'src'),
      },
      {
        test: /\.less$/,
        loader: "style-loader!css-loader!less-loader"
      }
    ]
  }
};

module.exports = config;

ERROR in ./src/app.js
Module build failed: ReferenceError: [BABEL] /Users/ user/gocode/src/github.com/natdm/mobilebid/frontend_v2/src/app.js: Unknown option: /Users/user/gocode/src/github.com/natdm/mobilebid/frontend_v2/node_modules/react/react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:
  `{ presets: [{option: value}] }`
Valid:
  `{ presets: [['presetName', {option: value}]] }`

它告訴我我有無效的預設選項,但我沒有任何預設選項,而且從來沒有任何預設選項,而且突然之間它已經破裂了。 我需要更新/更改才能使其正常工作?

你的.babelrc文件似乎是正確的,只要確保你已經安裝

在使用它們之前的所有預設

  npm install babel-preset-es2015 babel-preset-react babel-preset-stage-2 --save-dev

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM