ES2017新增对象的扩展运算符特性,但自己编译错误,下面是主要文件。
// main.js
let {a, ...x} = {a: 1, b: 2, c: 3}
console.log(a, x)
// webpack.config.js
{
test: /\.js$/,
exclude: /node_modules/,
use: [{
loader: "babel-loader",
options: {
presets: ["es2015", "es2017"],
plugins: [
"transform-runtime"
]
}
}]
},
SyntaxError: Unexpected token
let {a, ...x} = {a: 1, b: 2, c: 3}
^
请教一下这样配置哪里有问题?谢谢
莫回无
相关分类