我有一个可以用 Angular 9 编译的库。但是如果我将标志更改为 --prod,这实际上使 "enableIvy": false
然后我得到
[error] RangeError: Maximum call stack size exceeded
at Object.pathIsRelative (...\node_modules\typescript\lib\typescript.js:5778:34)
at tryLoadModuleUsingPathsIfEligible (...\node_modules\typescript\lib\typescript.js:28346:37)
at tryLoadModuleUsingOptionalResolutionSettings (...\node_modules\typescript\lib\typescript.js:28334:24)
at tryResolve (...\node_modules\typescript\lib\typescript.js:28479:28)
at ...\node_modules\typescript\lib\typescript.js:28471:69
at Object.forEach (...\node_modules\typescript\lib\typescript.js:309:30)
at nodeModuleNameResolverWorker (...\node_modules\typescript\lib\typescript.js:28471:25)
at nodeModuleNameResolver (...\node_modules\typescript\lib\typescript.js:28464:16)
at Object.resolveModuleName (...\node_modules\typescript\lib\typescript.js:28238:30)
at CompilerHostAdapter.getMetadataFor (...\node_modules@angular\compiler-cli\src\metadata\bundler.js:567:37)
我在
function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state)
中引入了控制台调试消息函数,它似乎是一个循环,大约有 20 moduleName
s。我不得不提到,如果我在没有 --prod
的情况下进行编译,我没有任何循环依赖警告。旗帜。更新:我修复了循环依赖项,并且没有更多的警告。
最佳答案
我在 angular 12.1.1
上遇到了同样的问题,我没有循环依赖,解决方案是改变 "enableIvy: false"
至 "compilationMode": "partial"
.
见 angular docs .
关于angular - "Maximum call stack size exceeded"在 Angular 9 ng build --prod 中用于库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62769793/