Skip to content

Maximum call stack size exceeded with large SVG #45564

@jaredtbates

Description

@jaredtbates

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 13.2.2 (I think)

We noticed this while upgrading from Angular 12 to 13. For now, we will upgrade to 13.2.2 instead of the latest.

Description

When compiling an app that has a large SVG in a template, the build fails with a "Maximum call stack size exceeded" error. This happens on both ng serve and ng build.

Please note: I understand my minimal reproduction may not be the ideal way to host SVGs in templates, however this is a rudimentary example to replicate an issue that we are seeing in our codebase. Thanks for understanding!

🔬 Minimal Reproduction

https://github.com/sightsoundtheatres/call-stack-repro

🔥 Exception or Error

./src/app/app.component.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Maximum call stack size exceeded
    at /Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@ngtools/webpack/src/ivy/loader.js:81:18
    at runMicrotasks ()
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
 [webpack-dev-middleware] RangeError: Maximum call stack size exceeded
     at InvokeFunctionExpr.visitExpression (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler/fesm2015/compiler.mjs:1616:20)
     at ExpressionTranslatorVisitor.visitInvokeFunctionExpr (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler-cli/bundles/chunk-IZWUTMTT.js:839:76)
     at InvokeFunctionExpr.visitExpression (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler/fesm2015/compiler.mjs:1617:24)
     at ExpressionTranslatorVisitor.visitInvokeFunctionExpr (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler-cli/bundles/chunk-IZWUTMTT.js:839:76)
     at InvokeFunctionExpr.visitExpression (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler/fesm2015/compiler.mjs:1617:24)
     at ExpressionTranslatorVisitor.visitInvokeFunctionExpr (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler-cli/bundles/chunk-IZWUTMTT.js:839:76)
     at InvokeFunctionExpr.visitExpression (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler/fesm2015/compiler.mjs:1617:24)
     at ExpressionTranslatorVisitor.visitInvokeFunctionExpr (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler-cli/bundles/chunk-IZWUTMTT.js:839:76)
     at InvokeFunctionExpr.visitExpression (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler/fesm2015/compiler.mjs:1617:24)
     at ExpressionTranslatorVisitor.visitInvokeFunctionExpr (file:///Users/jared.bates/Code/Frontend/call-stack-repro/node_modules/@angular/compiler-cli/bundles/chunk-IZWUTMTT.js:839:76)

🌍 Your Environment


Angular CLI: 13.3.2
Node: 16.14.2
Package Manager: npm 8.5.5
OS: darwin arm64

Angular: 13.3.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1303.2
@angular-devkit/build-angular   13.3.2
@angular-devkit/core            13.3.2
@angular-devkit/schematics      13.3.2
@schematics/angular             13.3.2
rxjs                            7.5.5
typescript                      4.6.3

Anything else relevant?

If I run node --stack-size=10000 ./node_modules/.bin/ng serve the program builds and serves just fine. However, this is obviously not an ideal solution.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: compilerIssues related to `ngc`, Angular's template compilerstate: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions