我有一个角度应用程序(/ src几乎不是8MB),当我尝试进行生产构建时,它需要超过80分钟来完成构建过程。 需要建议来提高构建速度。
ng --version
@angular/cli: 1.4.3
node: 8.9.1
os: linux x64
@angular/animations: 4.3.5
@angular/common: 4.3.5
@angular/compiler: 4.3.5
@angular/core: 4.3.5
@angular/forms: 4.3.5
@angular/http: 4.3.5
@angular/platform-browser: 4.3.5
@angular/platform-browser-dynamic: 4.3.5
@angular/router: 4.3.5
@angular/cli: 1.4.3
@angular/compiler-cli: 4.3.5
typescript: 2.2.2
/ src $ 查找。 -type f | sed -e' s /.*.//' |排序| uniq -c
3 css
2 eot
4 gif
1 gitkeep
212 html
2 ico
1 jpg
1 js
3 json
9 png
213 scss
48 svg
370 ts
2 ttf
2 woff
node --max-old-space-size = 4096 node_modules / .bin / ng build --prod --env = prod --base-href --verbose
4007ms building modules
1ms module and chunk tree optimization
581ms chunk modules optimization
0ms advanced chunk modules optimization
0ms module reviving
18ms module order optimization
4ms module id optimization
0ms chunk reviving
8ms chunk order optimization
33ms chunk id optimization
1002ms hashing
0ms module assets processing
16779ms chunk assets processing
6ms additional chunk assets processing
2ms recording
0ms additional asset processing
4803967ms chunk asset optimization
7737ms asset optimization
222514ms emitting
答案 0 :(得分:2)
我解决了构建速度问题,我错过了--base-href <base>
以下ng build命令现在可以正常工作:
node --max-old-space-size=7000 node_modules/.bin/ng build --prod --env=prod --base-href .