2017-02-22 8 views
1

die folgende Fehlermeldung erhalten, wenn webpack zu laufen versuchen: Befehl: webpack -d --watchFehler Transpiling Babel/React (Unbekannt Option)

.babelrc:

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

webpack config:

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

Es sagt mir, dass ich ungültige voreingestellte Optionen habe, aber ich habe keine, und ich hatte nie welche, und auf einmal bricht es. Was muss ich aktualisieren/ändern, damit dies funktioniert?

Antwort

2

Ihre .babelrc Datei scheint richtig, nur um sicherzustellen, dass Sie

alle Presets

sie über installiert haben Yep
npm install babel-preset-es2015 babel-preset-react babel-preset-stage-2 --save-dev 
+1

vor dem Gebrauch. Sie wurden alle installiert. Ich musste nur node_modules ausblasen und neu installieren und es funktionierte. Oh Javascript. –