Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpack / Babel / React build error: "Unknown option: foo/node_modules/react/react.js.Children"

I'm trying to build a project with webpack and react with this webpack config:

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"
      },
    ]
  }
};

I am sure I have the needed pm modules too and have webpack installed, however when running webpack I get:

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

Any ideas?

like image 504
SuperUberDuper Avatar asked Nov 16 '15 16:11

SuperUberDuper


1 Answers

Sorry I forgot to install babel-preset-react:

$ npm install babel-preset-react --save-dev
like image 144
SuperUberDuper Avatar answered Oct 18 '22 05:10

SuperUberDuper