我是Babel的新手,想知道如何在转发async / await到es6 / 5的同时保留我的ES6课程。
每次我尝试使用Webpack进行转换和捆绑时,Chrome 53中支持的类都会向后反转。 Webpack.config.js
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: ['babel-polyfill','./src/entry.js'],
output: {
path: path.resolve(__dirname, 'build'),
filename: 'app.bundle.js',
library:'bundle',
libraryTarget:'umd'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: ["./node_modules"],
loader: 'babel-loader',
query: {
presets: ['env'],
}
}
]
},
stats: {
colors: true
},
devtool: 'source-map'
};
babelrc
{
"plugins": [
["babel-plugin-transform-builtin-extend", {
globals: ["Error", "Array"]
}]
],
"presets": [[
"env", {
"targets" : {
"chrome" : 53
},
"useBuiltIns": true,
"debug": true,
"modules" : false,
}]
],
}
我希望有人可以帮助我。
(PS:我尝试使用babel-plugin-transform-builtin-extend,但忽略了它)