安装loader:
npm --save-dev install babel-loader@7 babel-core babel-preset-es2015
{
// ES6 转ES5 npm --save-dev install babel-loader@7 babel-core babel-preset-es2015
test: /\.js$/,
// 排除,不打包该文件夹下的js
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
}