angularangular-cliaotangular-compiler-cli

Angular AoT angular compiler cli vs angular-cli


what is the difference between this guide https://angular.io/guide/aot-compiler that use @angular/compiler-cli and using command ng build --prod (that use options --aot)??


Solution

  • The Angular CLI takes care of more than just compiling your files for AOT.

    Along with the AOT compilation, using ng build -prod will also minify, uglify, (partially) eliminate dead code, and bundle your application appropriately (including lazy loaded bundles).

    Side note:

    You can also use the --build-optimizer flag to further optimize your code. It will remove the vendor bundle, but your overall bundle size should be smaller. This flag is experimental right now and will eventually (hopefully) be moved into the -prod flag. One of the noticeable reasons it's not is that it makes compilation longer.