optimization.concatenateModules 卡在此处 79% 很长时间。一直在优化?代码写的太臃肿了?
win 10 4h8g 时间是 2600 秒左右===40 多分钟。
CentOS 4H8G 36 分钟完成
尝试过增加打包服务器配置( CentOS 7 ),4 核 8G,8 核 16G 等都尝试过,甚至用了 16 核 32G 的电脑,没有明显的改善, 用 2 核 4G 的服务器会导致服务器占用达到 100%而服务器瘫痪。
我的项目 不算大,依赖的组件也不多,打包成功后,经压缩的 zip 文件是 3.6Mb 左右的大小。 打包命令是 "bp8": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --prod",
package.json
{
"name": "www",
"version": "6.8.21",
"description": "www",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.config.json",
"build": "set NODE_OPTIONS=--max_old_space_size=4096 && ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"prod": "ng build --prod --vendor-chunk=true",
"build-prod": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod",
"bp": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod",
"bp8": "node --max_old_space_size=8000 ./node_modules/@angular/cli/bin/ng build --prod",
"bp16": "node --max_old_space_size=15000 ./node_modules/@angular/cli/bin/ng build --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "8.0.0-beta.6",
"@angular/cdk": "7.3.7",
"@angular/common": "8.0.0-beta.6",
"@angular/compiler": "8.0.0-beta.6",
"@angular/core": "8.0.0-beta.6",
"@angular/forms": "8.0.0-beta.6",
"@angular/http": "8.0.0-beta.6",
"@angular/material": "7.3.7",
"@angular/material-moment-adapter": "7.3.7",
"@angular/platform-browser": "8.0.0-beta.6",
"@angular/platform-browser-dynamic": "8.0.0-beta.6",
"@angular/pwa": "0.13.7",
"@angular/router": "8.0.0-beta.6",
"@angular/service-worker": "8.0.0-beta.6",
"angular2-baidu-map": "4.6.0",
"core-js": "2.6.5",
"hammerjs": "2.0.8",
"immer": " 3.1.1",
"moment": "2.24.0",
"ng2-file-upload": "1.3.0",
"ngx-toastr": "10.0.2",
"reuse-tab": "1.0.5",
"rxjs": "6.5.2",
"rxjs-compat": "6.5.2",
"web-animations-js": "2.3.1",
"zone.js": "0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.13.9",
"@angular/cli": "7.3.7",
"@angular/compiler-cli": "8.0.0-beta.6",
"@angular/flex-layout": "^7.0.0-beta.24",
"@angularclass/hmr": "2.1.3",
"@types/node": "12.0.0",
"ts-node": "8.1.0",
"typescript": "3.1.6"
}
}
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.