brunch / terser-brunch

A javascript minifier for brunch files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arrow functions / ES6 error ?

KrishnaPG opened this issue · comments

Getting below error for below code:

CBM-Demo>brunch build --production
31 Jul 22:02:37 - error: JS minification failed on www/js/app.js: Unexpected token: operator (>) (line: 216, col: 64, pos: 5307)

Error
    at new JS_Parse_Error (\node_modules\uglify-js\lib\parse.js:196:18)
    at js_error (\node_modules\uglify-js\lib\parse.js:204:11)
    at croak (\node_modules\uglify-js\lib\parse.js:680:9)
    at token_error (\node_modules\uglify-js\lib\parse.js:688:9)

code sample

ages[0] = _.chain(source).map('age1').map(x => { return parseInt(x) }).filter(x => { return !isNaN(x) && x > 0; }).value();
ages[1] = _.chain(source).map('age2').map(x => { return parseInt(x) }).filter(x => { return !isNaN(x) && x > 0; }).value();

Perhaps we need to update uglify.

Hey @KrishnaPG. UglifyJS ^2 does not support ES6 (yet). Please, take a look at babili. I will close this one, because it is not an issue with plugin itself.