I was just reading Angular 2 AOT documentation and a few questions poped up
The documentation clearly favours AOT over JIT and mentioned all the good stuff about how AOT is better. If that is the case why wouldn't AOT be the default build rather than doing ng build --prod --aot
The documentation goes through in detail about how to set it up. Would ng build --prod --aot
be good enough to ignore all those setup?
- The documentation clearly favours AOT over JIT and mentioned all the good stuff about how AOT is better. If that is the case why wouldn't AOT be the default build rather than doing
ng build --prod --aot
AoT is the default for -prod
as of beta 28.
It's still NOT the default for dev build. Why? Because it takes longer time to compile and in dev you want fast feedback.
Note that the current version of the Angular CLI at the time of writing is beta.29, and the package name has changed from angular-cli
to @angular/cli
.
- The documentation goes through in detail about how to set it up. Would
ng build --prod --aot
be good enough to ignore all those setup?
Yes!
And you can just ng build -prod
if you are using the latest version of the CLI.
As part of angular-cli, you should have the required NPM dependencies to compile using AOT. It seems as though AOT will be enabled if targeting prod in the very near future. It was accidentally enabled by default in an earlier version of angular-cli and that caused a few headaches.
Running ng build --prod --aot=true
will work on a brand new angular-cli application without additional configuration or setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With