angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng build --prod --aot --output-hashing none stuck at chunk asset optimization after Angular V 5 upgrade

Open rahulrsingh09 opened this issue 9 years ago • 25 comments

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

rahulrsingh09 avatar Nov 04 '17 15:11 rahulrsingh09

I'm seeing the same thing

shusson avatar Nov 06 '17 02:11 shusson

me too

finalxcode avatar Nov 06 '17 07:11 finalxcode

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

long_build_times

rametta avatar Nov 06 '17 21:11 rametta

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

rahulrsingh09 avatar Nov 07 '17 04:11 rahulrsingh09

Yes, me too. But as the result I have got a smaller bundles.

wuzhouyang avatar Nov 09 '17 07:11 wuzhouyang

Same here. just using ng build --prod. Angular & Angular-cli 5 final.

theunreal avatar Nov 20 '17 11:11 theunreal

I'm facing the same issue and its the same with --build-optimizer=false

codech3ry avatar Dec 01 '17 02:12 codech3ry

Yes, me too, It is taking 2-3 min simple project and In the lager project taking 10+ Min

lakshmanavula avatar Dec 04 '17 09:12 lakshmanavula

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?

filipesilva avatar Dec 07 '17 16:12 filipesilva

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.

theunreal avatar Dec 07 '17 17:12 theunreal

@filipesilva This build --prod is still extremely slow, Time: 261184ms

theunreal avatar Dec 11 '17 12:12 theunreal

@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

elvirdolic avatar Dec 12 '17 20:12 elvirdolic

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)

NikolaosWakem avatar Dec 14 '17 11:12 NikolaosWakem

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 avatar Dec 31 '17 13:12 zoharyosef

@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?

elvirdolic avatar Jan 21 '18 21:01 elvirdolic

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

Sathishchary avatar Feb 21 '18 16:02 Sathishchary

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.

aaa

abhinavJai avatar Mar 08 '18 08:03 abhinavJai

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

image

and below code in /usr/bin/ng file

image

It is taking more than 60 minutes for my ng build --prod command.

vinayakshukre avatar Mar 21 '18 10:03 vinayakshukre

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" }

vinayakshukre avatar Mar 29 '18 09:03 vinayakshukre

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

rightisleft avatar May 08 '18 22:05 rightisleft