Angular ngcc和ivy
我Angular項目的angular.json文件里有這么一行:
“aot”: true,
意思是使用Ivy編譯, 即Angular 下一代編譯和渲染管道的代號。 從 Angular 的版本 9 開始,這個新的編譯器和運行時指令集就代替了老的編譯器和運行時(即視圖引擎 View Engine)成為了默認值。
可以使用通過 View Engine 編譯器創建的庫來構建 Ivy 應用程序。此兼容性由稱為 Angular 兼容性編譯器( ngcc )的工具提供。CLI 命令在執行 Angular 構建時會根據需要運行 ngcc.
如果你是庫作者,則應從版本 9 之后繼續使用 View Engine 編譯器。通過讓所有庫繼續使用 View Engine,你將與使用 Ivy 的默認 v9 應用程序以及已選擇的應用程序保持兼容性。
ngcc即我們每次ng serve時看到的ngcc(worker):
The Angular ahead-of-time (AOT) compiler converts Angular HTML and TypeScript code into efficient JavaScript code during the build phase, before the browser downloads and runs that code. This is the best compilation mode for production environments, with decreased load time and increased performance compared to just-in-time (JIT) compilation.
By compiling your application using the ngc command-line tool, you can bootstrap directly to a module factory, so you don’t need to include the Angular compiler in your JavaScript bundle.
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的Angular ngcc和ivy的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ROS2 MAC OS Install
- 下一篇: 公户转私户多久到账