Angular 12: RangeError: Maximum call stack size exceeded

Angular 12: RangeError: Maximum call stack size exceeded

构建时出现此错误:

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

更新:如果我关闭 sourcemaps

,它将使用 aot 进行编译

更新:我没有像最初所说的那样使用 Angular 12.1。它实际上是版本 12.2。我还可以得出结论,我正在遭受此错误的困扰:https://github.com/webpack/webpack-sources/issues/131

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