Angular:能有人解释一下关于Angular IVY的ng build吗?

huangapple go评论48阅读模式
英文:

Angular: Can someone explain ng build in reference to Angular IVY?

问题

我知道Angular IVY自Angular 9起默认使用AOT。从谷歌搜索中,我了解到:

ng build --dev使用JIT

ng build --prod使用AOT

我试图调和这两个选项,特别是第一个(使用JIT)与Ivy渲染引擎的工作方式,因为它使用AOT,似乎存在冲突?

英文:

I know Angular IVY uses AOT by default since Angular 9.
From googling, I understand that

ng build --dev uses JIT

ng build --prod uses AOT

Am trying to reconcile how these two options especially the first one (which uses JIT) works with Ivy Rendering Engine since its using AOT which seem to conflict with each other?

答案1

得分: 0

我认为你的困惑是因为不理解AOT/JIT和Ivy之间的区别。Ivy是一个渲染引擎,这意味着Ivy会接受你的模板(HTML)并将其转换为TypeScript(简单来说)。JIT/AOT是将生成的TypeScript转换为浏览器可读的JavaScript的策略。

英文:

I think your confusion is a result of not understanding the difference between AOT/JIT and Ivy. Ivy is a rendering engine, which means that Ivy takes your templates (HTML) and transforms them into TypeScript (in simple terms). JIT/AOT are strategies for transforming generated TypeScript into JavaScript that can be read by the browser.

huangapple
  • 本文由 发表于 2023年6月18日 23:38:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76501308.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定