It was my understanding that during ng build AOT compilation is used by default and that only in development (ng serve) you are required to set --aot flag.
But right now I have a project in front of me which makes use of classes and methods from the @angular/compiler at multiple locations. Nevertheless the outcome of 'ng build' with production: true in the environment works without any failures and seems to be aware of the compiler. If I use 'ng serve --aot' however I receive the expected 'Uncaught Error: Runtime compiler is not loaded'.
So what's the deal? Is AOT used by default or not.
BTW: The project uses Angular version ^4.0.0.
Edit
@Melou and @PierreDuc showed me where I was wrong: ng build --prod
is not the same as ng build -e prod
. The production setting in the environment does not change the compilation process. --prod
also sets --target=production
which will trigger the AOT compilation.