Cannot investigate ng build --prod UglifyJs failure
Bug Report or Feature Request (mark with an x)
- [X] bug report -> please search issues before submitting
- [] feature request
Versions.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
@angular/cli: 1.0.0
node: 6.9.4
os: darwin x64
@angular/animations: 4.0.0
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/compiler-cli: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/platform-server: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
Repro steps.
I run...
ng build --prod
But uglify fails and there's no way to investigate it because the dest folder isn't created on this failure. Specifically trying to investigate Unexpected token operator «=», expected punc «,» .
chunk {0} 0.d17559b9dc1f9710df9e.chunk.js 977 kB {1} {2} [rendered]
chunk {1} 1.3fb611ed62385f1481c5.chunk.js 762 kB {0} {2} [rendered]
chunk {2} main.6670c5c330feeaa5af25.bundle.js (main) 760 kB {5} [initial] [rendered]
chunk {3} scripts.bf4293b30b91e67e776a.bundle.js (scripts) 124 kB {6} [initial] [rendered]
chunk {4} styles.5d73c197136fb409042d.bundle.css (styles) 228 bytes {6} [initial] [rendered]
chunk {5} vendor.1f74f5a264bded28ec07.bundle.js (vendor) 3.63 MB [initial] [rendered]
chunk {6} inline.51a70f6c591274413cac.bundle.js (inline) 0 bytes [entry] [rendered]
ERROR in 0.d17559b9dc1f9710df9e.chunk.js from UglifyJs
Unexpected token operator «=», expected punc «,» [0.d17559b9dc1f9710df9e.chunk.js:9262,39]
The log given by the failure.
Desired functionality.
Would like some more context. The intermediate files should not be deleted on an UglifyJs failure because there's not much to go on.
Mention any other details that might be useful.
This error started for me today after I tried to update to angular 4 and the new angular cli.
I had following error,
ERROR in vendor.26896e0d308d49cc81c8.bundle.js from UglifyJs Unexpected token: punc ()) [vendor.26896e0d308d49cc81c8.bundle.js:1806,12]
and it is fixed with ng build --prod --source-map
later I get heap error and node --max_old_space_size=12000 ./node_modules/.bin/ng build --prod --source-map command solved that too.
Update:
Only with --build-optimizer=false and --source-map I was able to get the location of the error
ng build --prod --named-chunks --verbose --build-optimizer=false --source-map
If I build my app, I am getting Unexpected token: punc ()):
$ ng build --prod
Date: 2019-01-26T22:32:18.173Z
Hash: b5bcaa2123bb6718baf2
Time: 28403ms
chunk {0} runtime.0935b498984fda7c2e4f.js (runtime) 2.23 kB [entry] [rendered]
chunk {1} common.78f3e0cd7d0f774768aa.js (common) 583 bytes [rendered]
chunk {2} main.2ae834dcaf8208d7aecd.js (main) 970 kB [initial] [rendered]
chunk {3} polyfills.588b345e325a2549098e.js (polyfills) 61.7 kB [initial] [rendered]
chunk {4} styles.088d5b7a7a0995d1df55.css (styles) 85.4 kB [initial] [rendered]
chunk {5} 5.7e99fa00323b77c4e1c2.js () 3.82 MB [rendered]
chunk {6} 6.954a4978d0c6c411bb2f.js () 6.3 kB [rendered]
ERROR in 5.7e99fa00323b77c4e1c2.js from Terser
Unexpected token: punc ()) [5.7e99fa00323b77c4e1c2.js:27338,4]
If I use --source-map, the error seems to disappear:
$ ng build --prod --source-map
Date: 2019-01-26T22:31:44.106Z
Hash: 51afc4cc158a10e520c6
Time: 45390ms
chunk {0} runtime.b29d49d6f279fff34f57.js, runtime.b29d49d6f279fff34f57.js.map (runtime) 2.29 kB [entry] [rendered]
chunk {1} common.70409de1782336a79716.js, common.70409de1782336a79716.js.map (common) 639 bytes [rendered]
chunk {2} main.01e8ea6a2dd33c4e19d8.js, main.01e8ea6a2dd33c4e19d8.js.map (main) 970 kB [initial] [rendered]
chunk {3} polyfills.22294cd4941de9604b91.js, polyfills.22294cd4941de9604b91.js.map (polyfills) 61.7 kB [initial] [rendered]
chunk {4} styles.97ca4c55e9ba593fdf4c.css, styles.97ca4c55e9ba593fdf4c.css.map (styles) 85.5 kB [initial] [rendered]
chunk {5} 5.33da963a3dd6decc5efc.js, 5.33da963a3dd6decc5efc.js.map () 1.9 MB [rendered]
chunk {6} 6.85bd192b02e86745d878.js, 6.85bd192b02e86745d878.js.map () 6.35 kB [rendered]
So that's that.
I have already removed node_modules and installed everything from scratch without success.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.