详解webpack es6 to es5支持配置
1. 安装webpack
npm install webpack --save-dev
2. 安装babel 实现 ES6 到 ES5
npm install --save-dev babel-core babel-preset-es2015
3.安装 babel-loader
npm install --save-dev babel-loader
webpack.config.js完整配置
module.exports = {
entry: './src/js/app.js',
output: {
path: './dest',
filename: 'app.bundle.js',
},
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
}]
},
babel: {
presets: ['es2015']
},
}
以上是 详解webpack es6 to es5支持配置 的全部内容, 来源链接: utcz.com/z/337068.html