angular - 将我的项目从 Angular 7.2 升级到 Angular 8 后,编译时间增加了 3 倍。我该如何解决
问题描述
我将我的项目升级到 Angular 8 版本。在升级过程中,我没有遇到任何错误。但是编译时间增加了3倍,没有任何错误。至少,我怎样才能得到旧的编译时间?
** PS:这个问题有一个错误原因。与此错误相关的问题** https://github.com/angular/angular-cli/issues/13734
Last Compile Before Angular 8 (with Angular 7.2)
Time: 1382.536ms -> main.cf29a89468d732f3f363.js (main) 12.4 MB
First Compile After Upgrading to Angular 8
Time: 6379.317ms -> main.da4147c72278bc767ee4.js (main) 12.3 MB
Second Compile After Upgrading to Angular 8 and After restart PC
Time: 3147.254ms -> main.da4147c72278bc767ee4.js (main) 12.3 MB
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "./",
"moduleResolution": "node",
"outDir": "../__dist_cli",
"sourceMap": true,
"target": "es5 ",
"module": "es2015",
"lib": [
"es2016",
"dom"
],
"typeRoots": [
"node_modules/@types",
"typings/custom"
]
}
Angular CLI: 8.0.0
Node: 12.3.1
OS: win32 x64
Angular: 8.0.0
解决方案
尝试使用命令构建包
ng build --es5BrowserSupport=false
这将只为现代浏览器生成包。这将帮助您确定差异装载包装构建是否需要额外的时间。
推荐阅读
- python - 以正确的日期格式将 SAS lib 导出到 csv(在 CSV 文件中)
- bash - 如何在 unix 中打印失败的挂载点?
- python - 如何在我的程序计算器中绑定键。特金特
- c++ - 在定义(.cpp 文件)中初始化静态浮点 constexpr 成员是否可能
- django-forms - 如何选择多个值而不使用 django 表单和 SelectMultiple 小部件进行控制?
- mysql - 如何规范化具有相似列名的表?
- android - 无法将对象传递给我的自定义复合控件
- android - 国家和民族的 Array.xml 列表
- jquery - 设置灯箱项目的顺序
- java - 如何在运行时更改此 TRUE 或 FALSE 值