angular - Angular 12 中的 AOT 编译
问题描述
Angular 文档指出:
*Ahead-of-Time (AOT), which compiles your application and libraries at build time. This is the
default since Angular 9.*
因此,如果我想使用 AOT 为生产编译我的 Angular 12 应用程序,我只需要键入ng build而不添加--prod并且既不在angular.json也不在package.json中添加特定配置?
这是我的 package.json中的ng build命令:
...
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prepare": "husky install"
},
...
谢谢你的帮助
解决方案
您不需要明确包含--prod
用于生产构建的命令 - 假设您使用的是最新版本的 Angular,即我收集的 v12。
默认的 angular.json 文件包含有关生产构建的配置文件部分,您可以保持原样。
推荐阅读
- powershell - 任务调度程序任务未执行 ps1 脚本
- c# - 如何通过按键盘上的单个键来防止调用多个 KeyDown 事件?
- sql - 如何在 SQLite 中根据语言选择获取所有数据
- reactjs - React Native WebView 没有加载 react js 站点(内置 react js)?
- php - 当我将根添加到我的 xml 文档时,我的 xml 的内容正在删除
- php - 将数组的键与已知值 PHP 进行比较
- php - 模拟点击外部域
- javascript - React Router 动态 url 渲染在静态 url 上
- selenium-webdriver - 用于响应式应用程序测试的移动仿真
- c++ - 如何在 C++ 中的数组中存储一个 char 数组