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

  • Essential Angular
  • Victor Savkin Jeff Cross
  • 183字
  • 2021-07-02 22:56:26

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.

主站蜘蛛池模板: 衡阳县| 甘南县| 确山县| 陵川县| 永胜县| 石柱| 金湖县| 德安县| 丹巴县| 四会市| 惠东县| 乌拉特中旗| 泸定县| 绥化市| 新沂市| 西安市| 莱州市| 论坛| 珠海市| 鲁山县| 马龙县| 芜湖县| 安顺市| 郎溪县| 巫山县| 张家川| 苗栗县| 深圳市| 万源市| 淳化县| 元氏县| 梨树县| 咸丰县| 龙山县| 吴江市| 焦作市| 隆尧县| 岫岩| 木里| 桐梓县| 万盛区|