Angular 中的即时 (JiT) 与提前 (AoT) 编译 [英] Just-in-Time (JiT) vs Ahead-of-Time (AoT) compilation in Angular
本文介绍了Angular 中的即时 (JiT) 与提前 (AoT) 编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我指的是 本文档 并遇到了编译概念.可以使用 JIT 或 AOT 编译.但是,我发现它很简短,需要详细了解以下几点,
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 following points in details,
- 这两种技术的区别
- 关于何时使用什么的建议
推荐答案
JIT - 及时编译 TypeScript 以执行它.
JIT - Compile TypeScript just in time for executing it.
- 在浏览器中编译.
- 单独编译每个文件.
- 无需在更改代码后和重新加载浏览器页面之前构建.
- 适合本地开发.
AOT - 在构建阶段编译 TypeScript.
AOT - Compile TypeScript during build phase.
- 由机器自己编译,通过命令行(更快).
- 所有代码一起编译,在脚本中内嵌 HTML/CSS.
- 无需部署编译器(Angular 大小的一半).
- 更安全,未公开原始来源.
- 适用于生产版本.
这篇关于Angular 中的即时 (JiT) 与提前 (AoT) 编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文