It takes forever in "92% chunk asset optimization" can it be cached or disabled?
Bug Report or Feature Request (mark with an x)
- [x] feature request
Versions.
@angular/cli: 1.0.0-rc.2 node: 6.9.2 os: darwin x64 @angular/common: 2.4.10 @angular/compiler: 2.4.10 @angular/core: 2.4.10 @angular/forms: 2.4.10 @angular/http: 2.4.10 @angular/platform-browser: 2.4.10 @angular/platform-browser-dynamic: 2.4.10 @angular/router: 3.4.10 @angular/cli: 1.0.0-rc.2 @angular/compiler-cli: 2.4.10
Desired functionality.
assets optimization it rarely changes when you only do coding, and specially for my project it takes 2-5 minutes each time. So it's killing my productivity. With "--verbose" it doesn't show me any specific files which I could remove temporally to speed up the process of compiling...
Hash: 51ba5014dae3bd179ab9
Time: 395021ms
chunk {0} main.bundle.js, main.bundle.js.map (main) 10.8 MB {4} [initial] [rendered]
chunk {1} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 278 kB {5} [initial] [rendered]
chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 751 kB {5} [initial] [rendered]
chunk {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 362 kB {5} [initial] [rendered]
chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.44 MB [initial] [rendered]
chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
Thanks.
Please also note that version 7.0 of the CLI now uses terser by default. No additional steps are necessary.
Hi, i fixed this issue in my work pc using powershell instead wsl. I don't know if any of you are using the linux subsystem but the cpus are locked, you cannot parallelize, so using powershell for build and serve boosted up my times.
I am talking about: ctr+c after +40minutes to -2minutes.
Can anybody tell why this issue has been closed? Our release build still takes literally years to complete. Always hangs at "92% chunk asset optimization".
My issue with this was solved when I finished using Ubuntu subsystem as npm default manager, it doesn't parallelize and this task last forever. I moved to powershell.
Can anybody tell why this issue has been closed? Our release build still takes literally years to complete. Always hangs at "92% chunk asset optimization".
@rbluethl, 92% is about where UglifyJSPlugin was being used. Updating to Angular 7 will help because a different plugin (Terser) is used. Also, you may be going out of RAM. Happened to me with a 4GB server at the beginning.
I'm still with Angular 6. This is what I'm using in production these days:
> ng build --prod --extract-css=true --sourceMap=false --aot --build-optimizer=true --vendor-chunk=true
And in development:
> ng serve --progress --open --sourceMap=true --optimization=false --aot --vendorChunk=true
--optimization=falsedisables the minification using UglifyJSPlugin, wich will help you.- And notice that it is recommended to use
--aotin both processes. --prod --aotwill reduce the build time and output size ;). See my previous comment: https://github.com/angular/angular-cli/issues/5775#issuecomment-402745894
-- prod is - - aot already.
@gangsthub I tried --optimization=false on our internal project (which takes 2:40 minutes generally to build). It didn't bring any improvement. In fact, it increased the build time to 2:44.
It's important to note that we are using ng build --watch=true though, not ng serve (your example). Maybe the flag is only valid for the serve subcommand.
You are right, @DiegoMGar. --prod includes --aot according to the documentation.
@Dzhuneyt, I might not be getting your issue correctly: why are you using build + watch in development? I don't think it's what it is thought for. Build makes a production bundle by default: https://angular.io/cli/build
@gangsthub because we have a fairly complex project that requires NGINX, Apache and forwarding these two to a static directory where the frontend source code is accessible (/dist). The "lite server" of Angular doesn't do the trick.
This seems to be more of an issue if you enable source maps. The following setup/commands work under Angular 7:
SourceMap settings in angular.json
"sourceMap": {
"hidden": true,
"scripts": true,
"styles": true
}
Using the following command:
node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --es5BrowserSupport=true --prod=true --aot --build-optimizer=true --output-hashing all --extract-css=true --output-path=./tmp/dist
It will stick at 92% for a while, but does eventually build.
Well, in my case the the process was terminating because of insufficient memory. I enabled swapping on build server and then it works perfectly fine.
Can we open this issue back again?
I got this error when i built in docker in Window, i changed the limit of memory to 4GB in virtualbox configuracion and it works for me.
I think we are facing this issue since Reflect metadata API is now part of the build process of angular, so we will have more computation input but the application will be more faster.I am trying to use some work around building it with Parcel since 1 GB ram is really not enough building complex angular project these days even with 4 GB of swap...
It will be really useful if we have cache output from the build so we can then attach this cache to Docker container and only the changes will be build instead the whole application.Yes some will say it will trigger more problems with cache but it depends on how well is written ;)
Angular-cli 7.1.2 using terser only, removed uglify. The problem is still the same. I don't understand why this issue is closed.
MacBook Pro 2017 (max configuration). On my colleague's laptop, it took like 6 times longer. Angular-cli 7.3.8 ng build --prod --aot
Date: 2019-05-22T14:17:10.865Z Hash: c46f53e11f136ebcccaf Time: 252612ms chunk {0} common.afc1032bf3c4b8275ad0.js (common) 13.3 kB [rendered] chunk {1} 1.a15ce621172a345de3fb.js () 17.7 kB [rendered] chunk {2} 2.2f5ed724319337a8e568.js () 35.4 kB [rendered] chunk {3} 3.60e537acc75ac058b27c.js () 18.4 kB [rendered] chunk {4} runtime.579f6773a2b26d94db5d.js (runtime) 3.55 kB [entry] [rendered] chunk {5} 5.347c1f3685ec3ba82396.js () 22.5 kB [rendered] chunk {6} main.9181a4cb2e65813f8502.js (main) 4.3 MB [initial] [rendered] chunk {7} polyfills.7b3fb56fc82120d2029f.js (polyfills) 61.7 kB [initial] [rendered] chunk {8} styles.268c785458aec578546e.css (styles) 326 kB [initial] [rendered] chunk {9} 9.cf61d9ddb5622467f3f3.js () 31 kB [rendered] chunk {10} 10.0cd72c145b577e65cf28.js () 5.3 kB [rendered] chunk {11} 11.9dfeb2dd944fe80224cf.js () 98.6 kB [rendered] chunk {12} 12.8aa7c4e6cdd6615f2014.js () 7.07 kB [rendered] chunk {13} 13.8999e86ed963ef839840.js () 29 kB [rendered] chunk {14} 14.8cf84a196f45ed341ce0.js () 5.31 kB [rendered] chunk {15} 15.d313fabcfc0d0a86d25d.js () 18.7 kB [rendered] chunk {16} 16.3bb6114bc3541835e4a0.js () 6.38 kB [rendered] chunk {17} 17.7c5dbc1fbe2336666081.js () 18.4 kB [rendered] chunk {18} 18.709082325c1f7cbbd1b9.js () 5.32 kB [rendered] chunk {19} 19.f75679cd15753e642ace.js () 5.32 kB [rendered] chunk {20} 20.ead991d5d12b29a5c046.js () 23.2 kB [rendered] chunk {21} 21.b19be2caaa1019c1d5a8.js () 5.32 kB [rendered] chunk {22} 22.b8710a26bd79a8f2d9d5.js () 6.36 kB [rendered] chunk {23} 23.31688d97f4b9eb3e8b7d.js () 5.31 kB [rendered] chunk {24} 24.4ddab1995018ff5b7989.js () 6.34 kB [rendered] chunk {25} 25.604287facfdf4d4ef67c.js () 5.34 kB [rendered] chunk {26} 26.7da604b902f6832785fa.js () 38 kB [rendered] chunk {27} 27.bdbbe5cfd351f05fb927.js () 44.5 kB [rendered] chunk {28} 28.8d1645bad2f255229883.js () 6.36 kB [rendered] chunk {29} 29.cae28ed727cef99550da.js () 18.2 kB [rendered] chunk {30} 30.0757b5c5e76726394c96.js () 36.1 kB [rendered] chunk {31} 31.f70fcde5f461f52b298f.js () 24.6 kB [rendered] chunk {32} 32.f6a13d5d31d0811486c1.js () 5.32 kB [rendered] chunk {33} 33.2f77b41e9e23b60d7a4c.js () 5.34 kB [rendered] chunk {34} 34.75833ca150c5c8fdd6bd.js () 5.32 kB [rendered] chunk {35} 35.c57bcf3e34e617dfabc6.js () 6.35 kB [rendered] chunk {36} 36.5fa2d920b12f46a07172.js () 6.35 kB [rendered] chunk {37} 37.a394ec89e4d0bf0d72a6.js () 6.36 kB [rendered] chunk {38} 38.b34cc886a6eaa8be42a7.js () 5.37 kB [rendered] chunk {39} 39.ffa574e6aed984aef474.js () 18 kB [rendered] chunk {40} 40.30389c2e462dcd3da05f.js () 6.36 kB [rendered] chunk {41} 41.8e53571d710cc118d3a7.js () 6.35 kB [rendered] chunk {42} 42.1489d4775a8537d8cf61.js () 23 kB [rendered] chunk {43} 43.d986a7e4817dc6559e1c.js () 30.8 kB [rendered] chunk {44} 44.416ca46085d6452e2aae.js () 56.9 kB [rendered] chunk {45} 45.807652b30c9ae86f81df.js () 48.8 kB [rendered] chunk {46} 46.0b5ed5eb48ede6e2a472.js () 59.3 kB [rendered] chunk {47} 47.23e8ca78a06e5de3029b.js () 51.2 kB [rendered] chunk {48} 48.61a69980e6f487c0562c.js () 20.1 kB [rendered] chunk {49} 49.b10ef4d1f7cad8e72cd1.js () 20.8 kB [rendered] chunk {50} 50.9ad9e94f088ad56d6dd8.js () 23.6 kB [rendered] chunk {51} 51.121732df2f2a4fcee042.js () 5.32 kB [rendered] chunk {52} 52.d288a7457b03303af53c.js () 5.3 kB [rendered] chunk {53} 53.a26d29e5795cb20db1c3.js () 36.1 kB [rendered] chunk {54} 54.985c05de0e4736723d6e.js () 5.33 kB [rendered] chunk {55} 55.577c2d061a42d919bbce.js () 6.67 kB [rendered] chunk {56} 56.46d02993596d7be5fcc6.js () 42.5 kB [rendered] chunk {57} 57.f182f866ab2ff39159a8.js () 58.9 kB [rendered] chunk {58} 58.aac5f7b34340b2766b37.js () 63.3 kB [rendered] chunk {59} 59.c6d03497f0a9fc3e2920.js () 5.3 kB [rendered] chunk {scripts} scripts.df23d47c2e627c65cf17.js (scripts) 262 kB [entry] [rendered]
Angular 8. The same issue
Running with node --max-old-space-size=8192 node_modules/@angular/cli/bin/ng build --prod --aot doesn't help
reduce --max-old-space-size=8192 , i had to use --max-old-space-size=4096 or lower : 2048, 1024... depending on the host
@bleuscyther Really only any use for small projects, will seriously impair large projects. Still if you have a small project, then this is the setting for you.