我正在尝试使用js-minify工具缩小我的angular-js代码,但它抛出异常为Error:Unexpected token:operator(>)
答案 0 :(得分:1)
Why don't you use a transpiler like https://babeljs.io/ to compile your es6 code down to es5 and than minify/uglify your source code.
In this way you can continue to enjoy writing code in es6.
答案 1 :(得分:0)
箭头函数表达式是ECMAScript 2015中引入的新功能。您的minifier可能还不支持它。你提到你试图这样做:
scope.chartData[0].reduce((a, b) => a + b, 0)
您可以在没有箭头功能的情况下重写它:
scope.chartData[0].reduce(function(a, b) {
return a + b
}, 0)