Just-in-Time (JiT) vs Ahead-of-Time (AoT) compilation in Angular

前端 未结 8 719
难免孤独
难免孤独 2020-12-04 05:50

I was referring this documentation and came across the compilation concept. One can use either JIT or AOT compilation. However, I found it very brief and need to know follow

8条回答
  •  春和景丽
    2020-12-04 06:15

    JIT - Compile TypeScript just in time for executing it.

    • Compiled in the browser.
    • Each file compiled separately.
    • No need to build after changing your code and before reloading the browser page.
    • Suitable for local development.

    AOT - Compile TypeScript during build phase.

    • Compiled by the machine itself, via the command line (Faster).
    • All code compiled together, inlining HTML/CSS in the scripts.
    • No need to deploy the compiler (Half of Angular size).
    • More secure, original source not disclosed.
    • Suitable for production builds.

提交回复
热议问题