npm install --save-dev babel-loader@7 babel-core babel-preset-es2015
或者
npm install babel-loader babel-core babel-preset-env webpack
{
test: /.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
}
官网
https://www.webpackjs.com/loaders/babel-loader/