Home > Net >  AOT compilation in Angular 12
AOT compilation in Angular 12

Time:10-02

Angular documentation states:

 *Ahead-of-Time (AOT), which compiles your application and libraries at build time. This is the 
 default since Angular 9.*

So if I want to compile for production my Angular 12 application with AOT I just need to type ng build without adding --prod and without adding specific configuration neither in angular.json nor in package.json?

This is the ng build command insieme my package.json:

...
"scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "prepare": "husky install"
  },
...

Thank for you help

CodePudding user response:

You don't need to explicitly include the --prod command for production build - given that you're using the latest version of Angular i.e. v12 I gather.

The default angular.json file includes a profile section about the production build and you can leave it as it is.

  • Related