官术网_书友最值得收藏!

Why would I want to do it?

Compiling your application ahead of time is beneficial for the following reasons:

  • We no longer have to ship the compiler to the client. And so it happens, the compiler is the largest part of the framework. So it has a positive effect on the download size.
  • Since the compiled app does not have any HTML and instead has the generated TypeScript code, the TypeScript compiler can analyze it to produce type errors. In other words, your templates are type safe.
  • Bundlers (for example, WebPack and Rollup) can tree shake away everything that is not used in the application. This means that you no longer have to create 50-line node modules to reduce the download size of your application. The bundler will figure out which components are used, and the rest will be removed from the bundle.
  • Finally, since the most expensive step in the bootstrap of your application is the compilation, compiling ahead of time can significantly improve the bootstrap time.

To sum up, using the AOT compilation makes your application bundles smaller, faster, and safer.

主站蜘蛛池模板: 广元市| 永兴县| 太和县| 常州市| 铅山县| 孝昌县| 龙里县| 元谋县| 通渭县| 海安县| 库尔勒市| 柏乡县| 张北县| 翁牛特旗| 台东市| 黄大仙区| 个旧市| 乃东县| 黄龙县| 鲁甸县| 东安县| 昭苏县| 江津市| 宁都县| 会泽县| 海阳市| 宜章县| 河西区| 吉首市| 民和| 资中县| 高邑县| 宁波市| 临高县| 深水埗区| 伊春市| 黑水县| 苏尼特左旗| 成安县| 新沂市| 静乐县|