使用 Angular CLI 构建超出了最大调用堆栈大小
Maximum call stack size exceeded for build with Angular CLI
我有一个大型项目,到目前为止 运行 在 webpack 上,并且在 angular@4.3.3 上运行良好。今天我计划将其转移到 ng-cli 以利用通用等功能。一切都运行良好,除了当我尝试在 prod/prod+aot 中构建项目时,我得到:超出最大调用堆栈大小。
检查了各个地方的问题,大多数人都告诉检查循环依赖。但是根据最新的 cli@1.2.7,应该在构建时间显示循环依赖,但事实并非如此。我计划增加节点虚拟机堆栈大小,但无法实现。不想用ng eject又陷入webpack的烂摊子里了
对于 cli@1.2.7
还有其他一些方法或解决方案吗
谢谢
package.json
{
"name": "test-project",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~4.3.3",
"@angular/compiler": "~4.3.3",
"@angular/core": "~4.3.3",
"@angular/forms": "~4.3.3",
"@angular/http": "~4.3.3",
"@angular/animations": "~4.3.3",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/material": "^2.0.0-beta.8",
"@angular/cdk": "^2.0.0-beta.8",
"@angular/platform-browser": "~4.3.3",
"@angular/platform-browser-dynamic": "~4.3.3",
"@angular/platform-server": "~4.3.3",
"@angular/router": "~4.3.3",
"angular2-highcharts": "~0.5.5",
"@types/highcharts": "~4.2.57",
"angular-2-local-storage" : "^1.0.1",
"ngx-infinite-scroll": "^0.5.1",
"jspdf" : "^1.3.3",
"@types/jspdf" : "^1.1.31",
"jspdf-autotable" : "^2.3.2",
"html2canvas": "^0.5.0-beta4",
"@types/html2canvas": "^0.5.34",
"core-js": "^2.4.1",
"jasmine-core": "^2.6.4",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.1",
"moment": "^2.18.1",
"zone.js": "^0.8.14",
"angular2-jwt" : "^0.2.3",
"@types/modernizr": "3.3.0"
},
"devDependencies": {
"@angular/language-service": "^4.0.0",
"@angular/compiler-cli": "~4.3.3",
"@angular/platform-server": "~4.3.3",
"@angular/cli": "1.2.7",
"hammerjs": "^2.0.8",
"hammer-timejs" : "^1.1.0",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "^2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "^2.6.4",
"jasmine-spec-reporter": "~4.1.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.1.0",
"tslib": "^1.7.1",
"tslint": "~5.4.3",
"typescript": "^2.4.1"
}
}
我和我的团队目前遇到了这个问题。我已经尝试了一切,从完全删除我们应用程序中桶的使用(我认为这是一个循环依赖问题,因为许多 SO 问题让我相信)
我的本地环境运行良好,但新部署出现最大调用堆栈问题。
比较我的节点模块后,我注意到 zone.js 现在是 0.8.17(之前是 0.8.16)
因此我在我的 package.json 中强制使用 0.8.16,并且一切正常.. BLAH 8 小时!
希望对您有所帮助。
编辑
这是 github 问题:https://github.com/angular/zone.js/issues/886
截至目前,已提出解决此问题的拉取请求。
找到解决方案,在我的延迟加载路由和模块中有一些循环依赖。
我有一个大型项目,到目前为止 运行 在 webpack 上,并且在 angular@4.3.3 上运行良好。今天我计划将其转移到 ng-cli 以利用通用等功能。一切都运行良好,除了当我尝试在 prod/prod+aot 中构建项目时,我得到:超出最大调用堆栈大小。
检查了各个地方的问题,大多数人都告诉检查循环依赖。但是根据最新的 cli@1.2.7,应该在构建时间显示循环依赖,但事实并非如此。我计划增加节点虚拟机堆栈大小,但无法实现。不想用ng eject又陷入webpack的烂摊子里了
对于 cli@1.2.7
还有其他一些方法或解决方案吗谢谢
package.json
{
"name": "test-project",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "~4.3.3",
"@angular/compiler": "~4.3.3",
"@angular/core": "~4.3.3",
"@angular/forms": "~4.3.3",
"@angular/http": "~4.3.3",
"@angular/animations": "~4.3.3",
"@angular/flex-layout": "^2.0.0-beta.8",
"@angular/material": "^2.0.0-beta.8",
"@angular/cdk": "^2.0.0-beta.8",
"@angular/platform-browser": "~4.3.3",
"@angular/platform-browser-dynamic": "~4.3.3",
"@angular/platform-server": "~4.3.3",
"@angular/router": "~4.3.3",
"angular2-highcharts": "~0.5.5",
"@types/highcharts": "~4.2.57",
"angular-2-local-storage" : "^1.0.1",
"ngx-infinite-scroll": "^0.5.1",
"jspdf" : "^1.3.3",
"@types/jspdf" : "^1.1.31",
"jspdf-autotable" : "^2.3.2",
"html2canvas": "^0.5.0-beta4",
"@types/html2canvas": "^0.5.34",
"core-js": "^2.4.1",
"jasmine-core": "^2.6.4",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.4.1",
"moment": "^2.18.1",
"zone.js": "^0.8.14",
"angular2-jwt" : "^0.2.3",
"@types/modernizr": "3.3.0"
},
"devDependencies": {
"@angular/language-service": "^4.0.0",
"@angular/compiler-cli": "~4.3.3",
"@angular/platform-server": "~4.3.3",
"@angular/cli": "1.2.7",
"hammerjs": "^2.0.8",
"hammer-timejs" : "^1.1.0",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "^2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.1.1",
"jasmine-core": "^2.6.4",
"jasmine-spec-reporter": "~4.1.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage": "^1.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.1.0",
"tslib": "^1.7.1",
"tslint": "~5.4.3",
"typescript": "^2.4.1"
}
}
我和我的团队目前遇到了这个问题。我已经尝试了一切,从完全删除我们应用程序中桶的使用(我认为这是一个循环依赖问题,因为许多 SO 问题让我相信)
我的本地环境运行良好,但新部署出现最大调用堆栈问题。
比较我的节点模块后,我注意到 zone.js 现在是 0.8.17(之前是 0.8.16)
因此我在我的 package.json 中强制使用 0.8.16,并且一切正常.. BLAH 8 小时!
希望对您有所帮助。
编辑
这是 github 问题:https://github.com/angular/zone.js/issues/886
截至目前,已提出解决此问题的拉取请求。
找到解决方案,在我的延迟加载路由和模块中有一些循环依赖。