_From @KarimMesallam on June 9, 2017 19:57_
Description:
Steps to Reproduce:
Example repo: N/A
@types/lodashcordova build android --prod or ionic cordova build ios --prodOn your root project directory, edit node_modules/@ionic/app-scripts/package.json file. Then in that file update uglify-js like this "uglify-js": "git+https://github.com/mishoo/UglifyJS2.git#harmony".
Then after that execute npm install (make sure right now you're at node_modules/@ionic/app-scripts. Ignore error that shown. I have shown error about jasmine's build for path variable that it seems like it need src, but it works at the end.
Output:
[21:42:34] build prod started ...
[21:42:34] clean started ...
[21:42:34] clean finished in 2 ms
[21:42:34] copy started ...
[21:42:34] ngc started ...
[21:42:47] ngc finished in 12.12 s
[21:42:47] preprocess started ...
[21:42:47] deeplinks started ...
[21:42:48] deeplinks finished in 1.03 s
[21:42:48] optimization started ...
[21:42:48] copy finished in 13.41 s
[21:43:08] optimization finished in 20.37 s
[21:43:08] preprocess finished in 21.40 s
[21:43:08] webpack started ...
[21:44:41] webpack finished in 93.22 s
[21:44:41] sass started ...
[21:44:41] uglifyjs started ...
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of date.
Error: Unexpected token operator 芦=禄, expected punc 芦,禄 in /Users/UserName/Sites/AppName/www/build/main.js at line 110238, col 38, pos 4240027
My ionic info:
global packages:
@ionic/cli-utils : 1.3.0
Cordova CLI : 7.0.0
Ionic CLI : 3.3.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.3.0
@ionic/cli-plugin-ionic-angular : 1.3.0
Cordova Platforms : android 6.2.3 browser 4.1.0 ios 4.4.0
Ionic Framework : ionic-angular 3.2.0
System:
Node : v6.10.2
OS : macOS Sierra
Xcode : Xcode 8.3.3 Build version 8E3004b
ios-deploy : 1.9.1
ios-sim : 5.0.13
Other Information:
app-scripts versions but was never able to fix it on [email protected].app-scripts should rely on https://github.com/mishoo/UglifyJS2/tree/harmony out of the box._Copied from original issue: ionic-team/ionic-cli#2414_
I have this issue too, I can't build prod version app , and even get "Uncaught SyntaxError: Unexpected token false " when I open the app on phone (old android cellphone). Also because "function debounce(fn, wait, immediate = false) " at main.js
Sorry, just use es5 now. The es6 minifiers are not very good yet. uglify-js is much better than uglify-es and babili. We'll figure out an option here as soon as possible.
Thanks,
Dan
Most helpful comment
Sorry, just use es5 now. The es6 minifiers are not very good yet.
uglify-jsis much better thanuglify-esandbabili. We'll figure out an option here as soon as possible.Thanks,
Dan