2017-02-22 8 views
1

に反応: コマンド:webpack -d --watchエラーTranspilingはバベル/ WebPACKの実行しようとすると、次のエラーを取得する(不明なオプション)

.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}]] }` 

それは私に無効なプリセットオプションがあることを伝えているが、私は何も持っていないし、何も持っていないし、突然それが壊れている。これを動作させるには、何を更新/変更する必要がありますか?

答えて

2

あなた.babelrcファイルはちょうどあなたが

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

うん経由でそれらを使用する前に

すべてのプリセットがインストールされていることを確認し、正しいと思われます。彼らはすべてインストールされました。私はnode_modulesを吹き飛ばして再インストールしなければなりませんでした。ああ、Javascript。 –

関連する問題