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