Search code examples
angularangular-cli-v7

Why do we ever need to set "--aot false" in angular prod build?


I know that "ahead of time compilation" provides compilation at the build time. There are also bunch of other advantages of --aot such as

  • the application is pre-compiled so there is no such a wait template

  • binding errors will be known at build time etc..

However, there is also an option to set --aot to false (for the prod build as well). Why do we ever need to set --aot to false? In other word, what kind of advantage does --jit provides? I just want to understand if there is any disadvantage of using --aot over --jit because otherwise, it sounds like I should always use --aot even in dev build. And if there is no trade-off by using --aot, then why it is not set as default for the ng build and ng serve ?


Solution

  • As @Ingo Burk mentioned in the comment, I end up with same findings so I wanted to post it as an answer.

    Also other interesting thing I found out was,

    However In version 5 and later, the compiler automatically performs this rewriting while emitting the .js file