Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Building exception (uglify) when using --prod #1255

Closed
ghost opened this issue Oct 2, 2017 · 3 comments
Closed

Building exception (uglify) when using --prod #1255

ghost opened this issue Oct 2, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 2, 2017

Short description of the problem:

I'm getting an exception when creating Ionic builds with --prod flag, caused by uglifyjs.

What behavior are you expecting?

I expect that uglifyjs properly uglifies all my code and the build can be run successfully.

Steps to reproduce:

  1. ionic cordova build ios --prod
[INFO] Running app-scripts build: --prod --platform ios --target cordova
       
[08:29:47]  build prod started ... 
[08:29:48]  clean started ... 
[08:29:48]  clean finished in less than 1 ms 
[08:29:48]  copy started ... 
[08:29:48]  ngc started ... 
[08:30:01]  ngc finished in 13.09 s 
[08:30:01]  preprocess started ... 
[08:30:01]  deeplinks started ... 
[08:30:02]  deeplinks finished in 1.13 s 
[08:30:02]  optimization started ... 
[08:30:06]  copy finished in 18.64 s 
[08:30:19]  optimization finished in 16.99 s 
[08:30:19]  preprocess finished in 18.12 s 
[08:30:19]  webpack started ... 
[08:31:30]  webpack finished in 71.62 s 
[08:31:30]  sass started ... 
[08:31:30]  uglifyjs started ... 
[08:31:32]  sass finished in 1.46 s 
[08:31:32]  cleancss started ... 
[08:31:33]  cleancss finished in 1.14 s 
Error: Uglify failed: Unexpected token operator «=», expected punc «,» in undefined at line undefined, col undefined, pos undefined
    at new BuildError (/Users/user/Development/app/sources/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at taskReject (/Users/user/Development/app/sources/node_modules/@ionic/app-scripts/dist/worker-process.js:36:22)
    at /Users/user/Development/app/sources/node_modules/@ionic/app-scripts/dist/worker-process.js:14:13

Which @ionic/app-scripts version are you using?
2.1.4

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
I know that this has been an issue with older Ionic version already, where one could install "uglifyjs#harmony" to fix the issue within the app-scripts dependency. But this doesn't seem to work anymore. I've seen this issue in many places and quite often, hence that's something you should really have a look at.

@stevengunneweg
Copy link

stevengunneweg commented Oct 2, 2017

I posted a temporary workaround for a failing --prod build in #1243

EDIT: I don't see the error myself, my build just gets stuck but maybe the workaround will work for you as well

@danbucholtz
Copy link
Contributor

@dani-inside,

Is your project available online for me to take a look?

Thanks,
Dan

@ghost
Copy link
Author

ghost commented Oct 3, 2017

Thanks guys. @danbucholtz : Unfortunately not. Meanwhile (yesterday) I managed to fix the issue by updating the app-scripts to latest release 3.0.0. After updating the custom configs (webpack.config.js / copy.config.js) I could build the project without any issues, with and without the --prod flag.

As the issue is fixed for me, you may close the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants