0%

webpack-ES6转ES5的babel

1.安装babel

1
npm install --save-dev babel-loader@7 babel-core babel-preset-es2015

2.代开webpack.config.js 进行配置

1
2
3
4
5
6
7
8
9
10
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015']
}
}
}

3.在终端执行

1
npm run build