Angular AOT ⌛️ (Ahead-of-Time) Compilation

Angular AOT Compilation

Angular AOT Compilation

Before the browser can render the application, it must be converted to executable JavaScript by the Angular compiler. You can compile the app in the browser, at runtime, as the application loads, using the just-in-time (JIT) compiler. Or you can use the ahead-of-time (AOT) compiler that can catch template errors and improve performance by compiling at build time.

Why AOT?

  • Faster rendering
  • Fewer asynchronous requests
  • Smaller Angular framework download size
  • Detect template errors earlier
  • Better security

How To Use Angular AOT?

The Angular CLI now automatically builds with AoT enabled if you use the –prod flag. So the easiest way is just to use angular-cli from beginning and when running:

ng build --prod

You are already building with AOT. Another way is go through this really overwhelming documentation.

Buy me a coffeeOut of coffee 😱, please help!