【问题标题】:Angular 12: RangeError: Maximum call stack size exceededAngular 12:RangeError:超出最大调用堆栈大小
【发布时间】:2021-08-23 09:56:22
【问题描述】:

我在构建时收到此错误:

Generating browser application bundles (phase: building).../home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js:21
        const lines = source.match(SPLIT_LINES_REGEX);
                             ^

RangeError: Maximum call stack size exceeded
    at String.match (<anonymous>)
    at streamChunksOfSourceMapFull (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js:21:23)
    at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunksOfSourceMap.js:389:6)
    at SourceMapSource.streamChunks (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/SourceMapSource.js:211:11)
    at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunks.js:13:17)
    at ReplaceSource.streamChunks (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/ReplaceSource.js:176:44)
    at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunks.js:13:17)
    at streamAndGetSourceAndMap (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamAndGetSourceAndMap.js:27:53)
    at CachedSource.streamChunks (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/CachedSource.js:208:35)
    at module.exports (/home/jde/edApp2Angular12/node_modules/webpack/node_modules/webpack-sources/lib/helpers/streamChunks.js:13:17)

我一直在寻找答案,但似乎总是“您的代码中某处存在无限循环”。但是这个错误的输出表明它来自 webpack,因此不是来自我的项目的错误。

如何找出问题所在?我从这里去哪里?

Angular 版本:12.2

Webpack 版本:5.47.1

更新:如果我关闭源映射,它将使用 aot 编译

更新:我没有使用前面所说的 Angular 12.1。它实际上是 12.2 版本。我也可以得出结论,我正在遭受这个错误:https://github.com/webpack/webpack-sources/issues/131

【问题讨论】:

  • 看起来像源映射问题。你能关掉 angular.json 中的 sourcemaps 吗?
  • 我在循环导入时遇到过这种情况。你检查过这个吗?
  • @MikeOne 感谢您的建议。如果我关闭源映射,它现在可以使用 aot 编译。不知道有什么办法可以解决?
  • 我已经得出结论,我正在遭受这个错误:github.com/webpack/webpack-sources/issues/131

标签: caching build configuration angular-cli


【解决方案1】:

我提到的错误的修复现已发布。在 webpack 的 v3.2.1 中,他们删除了导致问题的正则表达式。我昨天运行了npm update,错误消失了。

【讨论】:

    猜你喜欢
    • 2021-03-07
    • 2018-01-24
    • 2018-02-06
    • 1970-01-01
    • 2019-05-14
    • 2019-02-07
    • 2021-05-30
    相关资源
    最近更新 更多