Search code examples
angularangular9jitaot

If Typescript requires compilation before the app is run, what does setting "aot" = false in Angular mean?


In our angular.json (Angular 9 app) config, we have

    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "outputPath": "dist/medicalapp",
        "index": "src/index.html",
        "main": "src/main.ts",
        "tsConfig": "tsconfig.app.json",
        "aot": true,

In as far as Angular is in Typescript, which requires compilation before the application runs, what does "aot" set to "false" do? Does that just mean if you edit a .ts file as the app is running it will not re-compile and you have to restart the app itself?


Solution

  • If you set to false it means that the application will be build with JIT compilation

    According to the documentation

    Just-in-Time (JIT), which compiles your app in the browser at runtime.

    What it means:

    It’s creates no minimizing bundles, so you will have access to files directly. You will can debugging and adding brackepoints directly to yours code. And as result on production each person can goes through the code.

    AOT will minimizing yours code and will give all advantages of AOT, as speed , minimal bundle size, protection from copy paste, unique hashes an so on.

    Answer for yours question AOT false will at first create bundle that’s will compiling from TS files, and browser with each reloading will interprete files into readable format, AOT will do it on the compiling step