reactjs – Webpack/Babel/React构建错误:“未知选项:foo/node_modules/react/react.js.Children”

前端之家收集整理的这篇文章主要介绍了reactjs – Webpack/Babel/React构建错误:“未知选项:foo/node_modules/react/react.js.Children”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图与webpack构建一个项目,并与此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"
      },]
  }
};

我相信我有所需的pm模块,并安装了webpack,但是当运行webpack我得到:

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

有任何想法吗?

对不起,我忘了安装babel-preset-react
原文链接:/react/303297.html

猜你在找的React相关文章