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
4

2 回答 2

0

尝试使用命令构建包

ng build --es5BrowserSupport=false

这将只为现代浏览器生成包。这将帮助您确定差异装载包装构建是否需要额外的时间。

于 2019-05-31T05:33:23.803 回答
0

这个问题在 Angular CLI (^8.2.1) 的更新版本中得到解决

于 2019-08-13T22:40:32.627 回答