npm install babel-core babel-loader babel-preset-env babel-preset-react html-webpack-plugin --save-dev code example
Example 1: jsx babel webpack
module.exports = {
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
}
]
}
};
Example 2: add webpack to react project
{ "presets": [ "@babel/preset-env", "@babel/preset-react" ]}