Uglifyjs fails with JS_Parse_Error error, but no stack trace

I’m trying to emulate my Ionic 2 app but the ufligy process is failint with a JS_Parse_Error, however there’s no additional information to know where the error could be.

As expected, there’s a white screen on the phone due to a syntax error on the compiled file.

Here there’s a recommendation to run uglify independently, so I’d like to know how to run it or over what file in order to get more information about a possible error.

It’s worth mention that if I run ionic serve everything is running ok. Here’s the error I’m receiving:

at new JS_Parse_Error (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1545:18)
    at js_error (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1553:11)
    at croak (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2092:9)
    at token_error (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2100:9)
    at unexpected (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2106:9)
    at expr_atom (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2621:13)
    at maybe_unary (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2795:19)
    at expr_ops (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2830:24)
    at maybe_conditional (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2835:20)
    at maybe_assign (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2859:20)
    at expression (eval at <anonymous> (/Users/urielhernandez/Documents/dev/ionic/photoMap/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:2878:20)

Additionally, this is the error after the apps executes on the emulator:

0     346390   error    Uncaught SyntaxError: Unexpected token ),, Line: 61596

Which is even more confusing since the file only has 47967 lines.

The problem happens when the ufligier tries to uglify an ES2016 file, in my case Dexie.js

I changed the package.json of dexie.js to use the ES5 file, so basically, you should not try to uglify some ES2016 such as the arrow function.