7

I got something like this:

ng build --prod --no-aot

But I am not able to understand what is the difference between

ng build --prod  

and

ng build --prod --no-aot
Melchia
  • 22,578
  • 22
  • 103
  • 117
jesusverma
  • 1,625
  • 1
  • 16
  • 17

3 Answers3

17

Update: For Angular 6+

Use the following command to disable AOT mode:

$ ng build --prod --aot=false --build-optimizer=false
Melchia
  • 22,578
  • 22
  • 103
  • 117
4

Just run command ng build -prod -aot=false. This will disable the aot compiler.

Joshua Kissoon
  • 3,269
  • 6
  • 32
  • 58
Bhavani Raju
  • 169
  • 2
  • 8
3

The flag --prod does the AOT compilation by default. If you want to build without AOT then simply run ng build only without any flag.

Ali Shahzad
  • 5,163
  • 7
  • 36
  • 64
  • I just want to know that what will be the effect on application? – jesusverma Aug 22 '17 at 10:19
  • 1
    With AOT, the browser downloads a pre-compiled version of the application. The browser loads executable code so it can render the application immediately, without waiting to compile the app first. – Ali Shahzad Aug 22 '17 at 19:10
  • Just to point out here that if you skip --prod then code is not uglified, prod environment variables are ignored, service workers are also ignored. The recommended way to avoid aot is by doing ng build -prod -aot=false – Unnie Jan 08 '18 at 17:40