尝试在我的项目上执行ng build --prod
时,会产生以下结果:
Date: 2017-09-17T16:03:06.816Z
Hash: d776bf985f9664cac088
Time: 3714ms
chunk {0} styles.d41d8cd98f00b204e980.bundle.css (styles) 0 bytes {3} [initial] [rendered]
chunk {1} polyfills.3bc34265385d52184eab.bundle.js (polyfills) 86 bytes {3} [initial] [rendered]
chunk {2} main.e402deade8b026b7d50e.bundle.js (main) 84 bytes [initial] [rendered]
chunk {3} inline.22b7623ed7c5ac6f9a35.bundle.js (inline) 1.45 kB [entry] [rendered]
ERROR in RangeError: Maximum call stack size exceeded
at Map.get (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15542:64)
at CompileMetadataResolver.getNgModuleSummary (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15502:52)
at /Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15594:68
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15589:49)
at CompileMetadataResolver.getNgModuleSummary (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15502:52)
at /Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15594:68
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15589:49)
at CompileMetadataResolver.getNgModuleSummary (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15502:52)
at /Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15594:68
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15589:49)
at CompileMetadataResolver.getNgModuleSummary (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15502:52)
at /Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15594:68
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15589:49)
at CompileMetadataResolver.getNgModuleSummary (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15502:52)
at /Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15594:68
at Array.forEach (native)
at CompileMetadataResolver.getNgModuleMetadata (/Users/chris/Documents/concord/node_modules/@angular/compiler/bundles/compiler.umd.js:15589:49)
使用常规ng build
或ng build --env=prod
可以正常工作,但每当使用AoT时,它都会失败。我发现了很多类似的问题,但没有一个解决方案适用于我的项目。