解决问题(Module build failed ReferenceError [BABEL] main.js Unknown option react.js.Children)

使用webpack和babel构建项目时报错,报错信息如下:

Module build failed: ReferenceError: [BABEL] /Users/me/foo/app/main.js: Unknown option: foo/node_modules/react/react.js.Children

Webpack配置如下:
var path = require('path'); var webpack = require('webpack'); module.exports = { entry: [ 'babel-polyfill', './app/less/main.less', './app/main.js', 'webpack-dev-server/client?http://localhost:8080' ], output: { publicPath: '/', filename: 'dist/main.js' }, debug: true, devtool: 'source-map', module: { loaders: [ { test: /\.js$/, include: path.join(__dirname, 'app'),loader: 'babel-loader', query: { presets: ['react', 'es2015'] } }, { test: /\.less$/, loader: "style!css!autoprefixer!less" }, ] } };

【解决问题(Module build failed ReferenceError [BABEL] main.js Unknown option react.js.Children)】解决办法很简单,只需使用npm安装babel-preset-react即可,如下:
npm install babel-preset-react --save-dev

    推荐阅读