ng build --prod --aot --output-hashing none stuck at chunk asset optimization after Angular V 5 upgrade
After Upgrading to Angular Version 5 the aot compilation seems to be stuck at 92 % chunk Optimisation for ages. and Completes after a full 4 mins
Date: 2017-11-03T13:54:26.604Z
Hash: 35cf6c5f7a300435f807
Time: 222890ms
chunk {0} 0.chunk.js () 16.7 kB [rendered]
chunk {1} main.bundle.js (main) 2.56 MB [initial] [rendered]
chunk {2} polyfills.bundle.js (polyfills) 63.8 kB [initial] [rendered]
chunk {3} styles.bundle.css (styles) 296 kB [initial] [rendered]
chunk {4} inline.bundle.js (inline) 1.36 kB [entry] [rendered]
Any reason for this slowness
I'm seeing the same thing
me too
Me too, mine sometimes >9mins, brutal. using angular cli 1.5 and angular v5.0.0
before upgrading to v5, prod build was around 4mins
plz send halp
I asked some one from the Angular team they are telling as build optimiser is enabled by default this is causing the prod build to be slower
Yes, me too. But as the result I have got a smaller bundles.
Same here.
just using ng build --prod. Angular & Angular-cli 5 final.
I'm facing the same issue and its the same with --build-optimizer=false
Yes, me too, It is taking 2-3 min simple project and In the lager project taking 10+ Min
Heya all,
With 1.5, --build-optimizer is turned on by default on production builds. It does make them slower but should result is smaller bundles.
There were some memory problems that we have meanwhile fixed. Can you try using 1.6.0 instead?
Thanks @filipesilva, I will check the performance of 1.6.0 against 1.5.0 without the build optimizer and will share the result here.
@filipesilva This build --prod is still extremely slow, Time: 261184ms
@theunreal how large is your app? Our build is much slower.
Time: 597079ms Angular CLI: 1.6.0 Node: 8.9.0 OS: win32 x64 Angular: 5.1.0
Angular CLI: 1.6.1 Node: 8.9.3 OS: win32 x64 Angular: 5.1.1
ng build --prod --output-hashing none
Time: 4181285ms ( 70 mins)
ng build --prod --output-hashing none --build-optimizer false
Time: 112442ms (< 2 mins)
Also on our project ng build --prod Angular 5.1.1 On the dev machine it takes about 4 mins. On the build server it takes more than an hour.
Thanks
@zoharyosef
we have since 1.6.5 the same issue. ON build server it takes now 30 minutes and on dev machine ng build --prod takes 5 minutes
Did you find out something?
I am also facing same problem here. ng build --prod is taking more than 15 mints to build the project. I am using cli : 1.7.0 angular :5.2.0 node: 6.9.1 os: windows 10 thanks
if you want to speedup the build process then you have to increase the memory.
For making build faster in production, we need to set the memory size in local machine
Steps 1:- C:\Users<username>\AppData\Roaming\npm
Steps 2:- Replace the ng.cmd file(attached here)
So by doing this, it will rectify “Java Script heap out of memory” error as well.

@abhinavJai How to do these settings on linux machine ? I can see below code in /usr/bin/npm file,

and below code in /usr/bin/ng file

It is taking more than 60 minutes for my ng build --prod command.
Adding following in package.json caused build time to improve. Now same build happens in less than 20 minutes. I increased memory to 12 GB
"scripts": { "build": "node --max_old_space_size=12288 ./node_modules/@angular/cli/bin/ng build --prod" }
This is pretty bad - simple bootstrap application with under 10 components takes 7 minutes when adding --prod
8 x core : Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz
Date: 2018-05-08T21:58:53.162Z
Hash: 8c7031545fe5681c541f
Time: 385794ms
chunk {0} main.0dacfdf444f92476e7b7.bundle.js (main) 3.31 MB [initial] [rendered]
chunk {1} polyfills.3b62166b1130a1e3b571.bundle.js (polyfills) 59.8 kB [initial] [rendered]
chunk {2} styles.65b4dbcde2c74fed70b8.bundle.css (styles) 285 kB [initial] [rendered]
chunk {3} inline.02c5a2b14b98749c9aca.bundle.js (inline) 804 bytes [entry] [rendered]
[END] WEB COMPILER STEPS
[END] CORE COMPILER STEPS
[go] Task status: passed, took: 7m 17.240s
[go] Current job status: passed
Angular CLI: 1.7.4
Node: 8.9.4
OS: darwin x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.2.5
@angular/cli: 1.7.4
@angular/material: 5.2.5
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0