ReactJS Module build failed: SyntaxError: Unexpected token - ReactDOM.render
I was getting the same error, and I simply needed to add a .babelrc file to the route of the project (same location as package.json) containing the following:
{
"presets": [
"env",
"react"
],
"plugins": [
"transform-class-properties"
]
}
Use this as your webpack config file
const webpack = require('webpack');
const path = require('path');
module.exports = {
entry: [
'./src/app.js'
],
output: {
path: path.resolve(__dirname, './build'),
filename: 'app.bundle.js',
},
module: {
loaders: [
{
test: /\.html$/,
loader: 'file-loader?name=[name].[ext]',
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
}
},
],
},
plugins: [
new webpack.NamedModulesPlugin(),
]
};
You are missing the presets