Babel-loader: ReferenceError when using webpack to compile project

Created on 25 Nov 2015  路  4Comments  路  Source: babel/babel-loader

When I am compiling a project to try out this repository I get the following error:

ReferenceError: [BABEL] /Users/xxx/Desktop/TestFolder/src/app.jsx: Unknown option: /Users/xxx/node_modules/react/react.js.Children

The file called src/app.jsx looks like this:

(function(){
  const React = require("react");
  const ReactDOM = require("react-dom");

  const App = React.createClass({
    render: function() {
      return (
        <h1>Hello</h1>
      );
    }
  });

  ReactDOM.render(<App />, document.getElementById("app"));
})();

And my webpack config file I have this:

var path = require("path");
var build = path.resolve(__dirname, 'build/');
module.exports = {
    entry: path.join(__dirname, '/src/app.jsx'),
    resolve: {
      extensions: ["", ".js", ".jsx", ".txt"],
    },
    output: {
        path: build,
        filename: "app.js"
    },
    module: {
      loaders: [
        {
          test: /\.jsx?$/,
          exclude: /(node_modules|bower_components)/,
          include: path.join(__dirname, '/src/'),
          loader: 'babel?presets[]=react,presets[]=es2015'
        }
      ]
    }
};

Please help me resolve this error so that I can continue to try out this repository. (I you need any mor info I'd be happy to provide it)

All 4 comments

Remove the include option from the loader

Thank you for trying to help me, but with this modification it still brings up the same error.

I've used the following files https://gist.github.com/Couto/8defa0595ccff73737f6 when trying your configuration.

It worked without any problem for me. Also.. I'm using node v5.1.0

I used the npm run build command

NVM. I just figured it out. Though, thank you anyways.

Was this page helpful?
0 / 5 - 0 ratings