webpack 打包压缩 ES6文件报错UglifyJs + Unexpected token punc «(», expected punc «:»

webpack打包压缩 ES6 js react报错:

升级到 babel6 了

ERROR in /Scripts/Test/test.bundle.js from UglifyJs
Unexpected token punc «(», expected punc «:» [/Scripts/Test/test.bundle.js:22901,

解决方案:

安装 babel-preset-es2015
npm install babel-preset-es2015 --save
配置babel
//加载器配置
loaders: [
{
  test: /.jsx$/,
  loader: 'babel-loader',
  query: {
    presets: ['react', 'es2015']
  }
}

 参考链接:webpack 打包压缩 ES6文件报错





原文地址:https://www.cnblogs.com/ekse/p/6814239.html