Uglifyjs Buil Problem


#1

Hi,

When I build my app, I have this error during the uglifyjs compile.

How can I fix or debug this ?

[23:07:18] sass started …
[23:07:19] uglifyjs failed: SyntaxError: Unexpected token: name (Wrapper_Button)
[23:07:19] ionic-app-script task: “build”
[23:07:19] Error: SyntaxError: Unexpected token: name (Wrapper_Button)


#2

Ok my bug it’s because I have changed value target to “es6” of tsconfig.json file. :weary:


#3

I am having the same issue when building (‘ionic serve’ works fine).
But my tsconfig target is ES5.
It seems to be an issue with an external package linq-es2015. But I have no control over it.

[12:32:13] sass started …
[12:32:17] uglifyjs failed: SyntaxError: Unexpected token: name (EnumerableImpl)
[12:32:17] ionic-app-script task: “build”
[12:32:17] Error: SyntaxError: Unexpected token: name (EnumerableImpl)

I have updated ionic, @ionic/app-scripts. Tried using --dev. Tried using custom uglifyjs.config.js and setting the mangle and compress to false.
Nothing worked.

My Ionic Info

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.1.0
Xcode version: Not installed

Any suggestions? Thank you.


#4

I resolved my issue.
Partially my own ignorance of that library. I though it had TS classes that would be transpiled to ES5. But as the name suggested (linq-es2015), it was ES6 only. Which uglifyjs fails on processing.

For anyone with this issue using this library, just change to linq-es5 package.


#5

Hi,

I am new to Ionic2. I am facing the same issue. I am not able to resolve this. Can you please explain me briefly along with some details it will help me a lot.

Thanks in advance


#6

Hi @dilipnikam

Could you paste the error message you are receiving, and the your tsconfig.
My issue was slightly different than that of @ekwoue.


#7

Hi @cperez1087,

Now this problem is resolved. For more details you can view below link.