3

On Angular's website, I read that the default compilation is JIT:

enter image description here

https://angular.io/guide/aot-compiler

I guess when it's on the official Angular website, it has to be JIT but on many other pages, I read that AOT is the default compilation in Angular 5.

This confuses me a little. In this question it also says that AOT is the default: Is the AOT Compilation the default on angular@4.0.0?

What is true now?

crashmstr
  • 28,043
  • 9
  • 61
  • 79
BlueCat
  • 673
  • 4
  • 16
  • 27
  • 5
    JIT is the default. To use AOT compilation, you need to add the `--aot` flag, and for the record, this flag is included in the `--prod` one. –  Apr 13 '18 at 12:37

1 Answers1

13

Read carefully the answer that you've linked.

they've made the AOT compilation the default for production builds.

  • ng serve is JiT
  • ng serve -prod is AoT
  • ng build is JiT
  • ng build -prod is AoT
Tomasz Kula
  • 16,199
  • 2
  • 68
  • 79
  • 5
    (Rules of Linux : flags with characters have a single hyphen, flags with string have two. Even though this works, use `--prod`, not `-prod`, you'll thank me someday) –  Apr 13 '18 at 12:50
  • This is straight from the `ng s --help` `--target (String) (Default: development) Defines the build target. aliases: -t , -dev (--target=development), -prod (--target=production), --target ` – Tomasz Kula Apr 13 '18 at 12:53
  • 2
    Again, I totally understand, as I said it works, I'm just saying that most of the time it will be two hyphens, so one should might aswell get used to it. –  Apr 13 '18 at 12:55