最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

Angular编译缓慢

IT培训 admin 5浏览 0评论

Angular编译缓慢

我在Symfony-PHP中有一个API,我用postman对其进行了测试,它的工作原理就像是一种魅力。但是,当我执行ng serve --aot --optimization时,应用程序开始构建,并且compiled successfully.的消息花费了超过一分钟的时间。当我需要对html组件(如字母)进行更改时,它将重新编译整个项目,并且花费这么小的更改时间太长。

--watch参数默认设置为true,可以。我不知道是否有人知道为什么编译这么慢。

版本:

Angular CLI: 6.2.2
Node: 8.12.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.8.2
@angular-devkit/core         0.8.2
@angular-devkit/schematics   0.8.2
@schematics/angular          0.8.2
@schematics/update           0.8.2
rxjs                         6.2.2
typescript                   2.9.2


oscar@ubuntu:~$: ng s --aot --optimization


****************************************************************************************
This is a simple server for use in testing or debugging Angular applications locally.
It hasn't been reviewed for security issues.

DON'T USE IT FOR PRODUCTION!
****************************************************************************************
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 10% building modules 7/8 modules 1 active ...s\orquestados-front-user\src\styles.cssBrowserslist: caniuse-lite is outdated. Please run next command `n 70% building modules 646/646 modules 0 activei 「wdm」: wait until bundle finished: /pages/offer/management/219702                                             92% chunk asset optimization TerserPlugini 「wdm」: wait until bundle finished: /pages/offer/management/219702
i 「wdm」: wait until bundle finished: /pages/offer/management/219702
Date: 2019-09-30T08:30:18.736Z
Hash: 9afdb6037df5643d0cb2
Time: 512136ms
chunk {0} runtime.js, runtime.js.map (runtime) 1.45 kB [entry] [rendered]
chunk {1} main.js, main.js.map (main) 2.3 MB [initial] [rendered]
chunk {2} polyfills.js, polyfills.js.map (polyfills) 62 kB [initial] [rendered]
chunk {3} styles.js, styles.js.map (styles) 45.6 kB [initial] [rendered]
chunk {4} vendor.js, vendor.js.map (vendor) 1020 kB [initial] [rendered]
i 「wdm」: Compiled successfully.
回答如下:

省略--optimization。这样,基于变更的构建将花费更少的时间。也尝试不使用--aot。首次构建总是需要一些时间。但是随后增量构建仅需几秒钟。

Angular编译缓慢

我在Symfony-PHP中有一个API,我用postman对其进行了测试,它的工作原理就像是一种魅力。但是,当我执行ng serve --aot --optimization时,应用程序开始构建,并且compiled successfully.的消息花费了超过一分钟的时间。当我需要对html组件(如字母)进行更改时,它将重新编译整个项目,并且花费这么小的更改时间太长。

--watch参数默认设置为true,可以。我不知道是否有人知道为什么编译这么慢。

版本:

Angular CLI: 6.2.2
Node: 8.12.0
OS: win32 x64
Angular:
...

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.8.2
@angular-devkit/core         0.8.2
@angular-devkit/schematics   0.8.2
@schematics/angular          0.8.2
@schematics/update           0.8.2
rxjs                         6.2.2
typescript                   2.9.2


oscar@ubuntu:~$: ng s --aot --optimization


****************************************************************************************
This is a simple server for use in testing or debugging Angular applications locally.
It hasn't been reviewed for security issues.

DON'T USE IT FOR PRODUCTION!
****************************************************************************************
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 10% building modules 7/8 modules 1 active ...s\orquestados-front-user\src\styles.cssBrowserslist: caniuse-lite is outdated. Please run next command `n 70% building modules 646/646 modules 0 activei 「wdm」: wait until bundle finished: /pages/offer/management/219702                                             92% chunk asset optimization TerserPlugini 「wdm」: wait until bundle finished: /pages/offer/management/219702
i 「wdm」: wait until bundle finished: /pages/offer/management/219702
Date: 2019-09-30T08:30:18.736Z
Hash: 9afdb6037df5643d0cb2
Time: 512136ms
chunk {0} runtime.js, runtime.js.map (runtime) 1.45 kB [entry] [rendered]
chunk {1} main.js, main.js.map (main) 2.3 MB [initial] [rendered]
chunk {2} polyfills.js, polyfills.js.map (polyfills) 62 kB [initial] [rendered]
chunk {3} styles.js, styles.js.map (styles) 45.6 kB [initial] [rendered]
chunk {4} vendor.js, vendor.js.map (vendor) 1020 kB [initial] [rendered]
i 「wdm」: Compiled successfully.
回答如下:

省略--optimization。这样,基于变更的构建将花费更少的时间。也尝试不使用--aot。首次构建总是需要一些时间。但是随后增量构建仅需几秒钟。

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论