I used the below-mentioned command:
npm install --save-dev babel-preset-stage-0
Now I added it in webpack.config.js file as shown below:
module.exports = {
entry: './app/app.jsx',
output: {
path: __dirname,
filename: './public/bundle.js'
},
resolve: {
root: __dirname,
alias: {
},
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
loader: 'babel-loader',
query: {
presets: ['react', 'es2015', 'stage-0']
},
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/
}
]
}
};
But Now when I run webpack command it shows some error. Please check error:
Error image:

If you are not using a .babelrc file, add babelrc: false like so:
module: {
loaders: [
{
loader: 'babel-loader',
babelrc: false, // <--- Add this
query: {
presets: ['react', 'es2015', 'stage-0']
},
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/
}
]
}
I recommend using the create-react-app CLI if you don't want to deal with the headache of setting up a development environment boilerplate. I just started using it and it is great!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With