angular-cli: AoT compilation with ng serve by default

Edit: starting with angular 9, aot compilation is enabled by default in development environment (see documentation)

In angular 6, you can specify default options for the serve target, so you can add aot: true in that section and by default ng serve will use aot

"serve": {
      "builder": "@angular-devkit/build-angular:dev-server",
      "options": {
        "browserTarget": "project:build",
        "aot": true
      },
      "configurations": {

Not directly an answer to your question, but rather an alternative way of achieving the same result. In your package.json file, you can add a custom script which compile with AoT.

...
"scripts": {
    "aot": "ng serve --aot"
  },
...

Then you can run the command npm aot.