module loader in babel code example
Example 1: install babel loader
npm install --save-dev babel-loader
Example 2: babel loader
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}