I am a bit confused by reading the doc about AOT. And I quote:
You can compile the app in the browser, at runtime, as the application loads, using the just-in-time (JIT) compiler. This is the standard development approach shown throughout the documentation. It's great but it has shortcomings.
I have 2 confusions here:
ng serve
as far as I understand it, right?
But in production, if I don't run my app this way, just ng build
it and host it by a web server like apache, is this "ng build" JIT
or AOT? Angular-cli
has taken care of everything to allow you to build
your app just by: ng build --aot
or ng server --aot
, am I
correct? So the doc should be for only when you want to do AOT
manually without Anuglar-cli
, right?The Angular CLI actually uses AOT for production build (ng build --prod
) by default. You can see this if you ever try to bind a private value in your component's class to your HTML/view and build it (it wont work).