Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable AOT in angular2?

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
like image 643
jesusverma Avatar asked Aug 22 '17 10:08

jesusverma


People also ask

How do I disable AOT?

Remove any -Xjit and -Xaot options (and accompanying parameters) from your command line. Use the -Xint command-line option to disable the JIT and AOT compilers.

Is AOT default in Angular 12?

By default, aot is set to true for new CLI applications. See the CLI command reference and Building and serving Angular apps for more information.

Does ng build prod use AOT?

The ng build command with the --prod meta-flag (ng build --prod) compiles with AOT by default. Why compile with AOT? 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.

Is AOT default in Angular 9?

Starting with Angular version 9, the default compilation of choice is AOT. This means that whenever you build your Angular application for production with the command ng build --prod , the application will also be compiled as part of the build process.


3 Answers

Update: For Angular 6+

Use the following command to disable AOT mode:

$ ng build --prod --aot=false --build-optimizer=false
like image 124
Melchia Avatar answered Sep 22 '22 23:09

Melchia


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

like image 29
Bhavani Raju Avatar answered Sep 25 '22 23:09

Bhavani Raju


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.

like image 41
Ali Shahzad Avatar answered Sep 23 '22 23:09

Ali Shahzad