babel-loader icon indicating copy to clipboard operation
babel-loader copied to clipboard

babel-loader 6 complains 'unexpected token <' when using with react (possible regression)

Open shikloshi opened this issue 11 years ago • 2 comments

This is my webpack.config.js for using with super-simple react application, when using with babel-loader 5.3.3 all works fine but when upgrading to babel-loader 6.0.1 this fails

module.exports = {
  entry: './app.js',

  module: {
    loaders: [
      { test: /\.js$/, exclude: /node_modules/, loader: 'jsx-loader!babel-loader' }
    ]
  }
}

This is the error:

ERROR in ./app.js
Module build failed: SyntaxError: /home/shikloshi/dev/private/react/appartment/app.js: Unexpected token (10:6)
   8 |   render() {
   9 |     return (
> 10 |       <div>Hello</div>
     |       ^
  11 |       )
  12 |   }

shikloshi avatar Nov 07 '15 08:11 shikloshi

Closing as this is a new behavior: http://stackoverflow.com/questions/33460420/babel-loader-jsx-syntaxerror-unexpected-token

shikloshi avatar Nov 07 '15 08:11 shikloshi

Not

options: { presets: ['react'] } but

options: { presets: ['@babel/preset-react'] }

Number77asa avatar Jan 21 '20 21:01 Number77asa