Angular-cli: build and ng serve really slow on aot , is there any solution ?

Created on 31 May 2017  路  7Comments  路  Source: angular/angular-cli

I am using cli1.0.6 and angular4.0.3 and have developed 100+ lazy load modules.
when enabled aot,
ng serve --aot=true can cause more than 10 min
and even ng build --prod --aot=true spend more than 10 min

that means aot cannot be used both on dev and prod

is there any way can help me ?

Most helpful comment

As it is stated in the official documentation:

"_Today AOT compilation and tree shaking take more time than is practical for development. That will change soon. For now, it's best to JIT compile in development and switch to AOT compilation before deploying to production._"

So it's better to develop your app in jit.

Source: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#jit-in-development-aot-in-production

All 7 comments

As it is stated in the official documentation:

"_Today AOT compilation and tree shaking take more time than is practical for development. That will change soon. For now, it's best to JIT compile in development and switch to AOT compilation before deploying to production._"

So it's better to develop your app in jit.

Source: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html#!#jit-in-development-aot-in-production

Closing as answered by @echonax, cheers!

I have the same question, how do you solve it

use "ng serve"
That should solve your problem

You can use this flag while compiling:
ng serve --source-map=false

It take 10sec to compile now while previously it was taking 32sec.
source-map is just used for debugging. So if not using debugger you can disable and compile.

I have a same issue "ng serve" take 30 minutes tocompile same code used to work faster when used on angular2. Please assist.
I am using windows7
@angular/cli: 1.0.4
node: 8.11.3
os: win32 x64
@angular/common: 4.4.7
@angular/compiler: 4.4.7
@angular/core: 4.4.7
@angular/forms: 4.4.7
@angular/http: 4.4.7
@angular/platform-browser: 4.4.7
@angular/platform-browser-dynamic: 4.4.7
@angular/router: 4.4.7
@angular/cli: 1.0.4
@angular/compiler-cli: 4.4.7

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JanStureNielsen picture JanStureNielsen  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

delasteve picture delasteve  路  3Comments

donaldallen picture donaldallen  路  3Comments