angular-cli: Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): Error: Maximum call stack size exceeded

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

No

Description

A clear and concise description of the problem...

I separated my code into modules and now I’m getting the following errors with no other explanation. I tried cleaning out the node_modules folder, cleared cache, and delete the package-lock file.

I also confirmed that I don’t have overlapping module imports.

πŸ”₯ Exception or Error




./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Maximum call stack size exceeded

./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Maximum call stack size exceeded

🌍 Your Environment




{
  "name": "src",
  "version": "1.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "start-dev": "ng serve --ssl --ssl-key xxxx.key --ssl-cert xxxxx.crt",
    "build": "ng build --configuration=production",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.0.6",
    "@angular/common": "^14.0.6",
    "@angular/compiler": "^14.0.6",
    "@angular/core": "^14.0.6",
    "@angular/forms": "^14.0.6",
    "@angular/platform-browser": "^14.0.6",
    "@angular/platform-browser-dynamic": "^14.0.6",
    "@angular/router": "^14.0.6",
    "@auth0/auth0-angular": "^1.10.0",
    "@fortawesome/angular-fontawesome": "^0.11.1",
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@mobiscroll/angular": "^4.10.9",
    "@popperjs/core": "^2.11.5",
    "animate": "^1.0.0",
    "animate.css": "^4.1.1",
    "bootstrap": "^5.1.3",
    "core-js": "^3.23.3",
    "rxjs": "~7.4.0",
    "twilio-video": "^2.21.3",
    "util": "^0.12.4",
    "webpack": "^5.73.0",
    "wowjs": "^1.1.3",
    "zone.js": "^0.11.6"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.0.6",
    "@angular-eslint/builder": "14.0.2",
    "@angular-eslint/eslint-plugin": "14.0.2",
    "@angular-eslint/eslint-plugin-template": "14.0.2",
    "@angular-eslint/schematics": "14.0.2",
    "@angular-eslint/template-parser": "14.0.2",
    "@angular/cli": "^14.0.6",
    "@angular/compiler-cli": "^14.0.6",
    "@types/jasmine": "^4.0.3",
    "@types/jasminewd2": "^2.0.10",
    "@types/node": "^18.0.0",
    "@types/offscreencanvas": "^2019.7.0",
    "@typescript-eslint/eslint-plugin": "5.29.0",
    "@typescript-eslint/parser": "5.29.0",
    "eslint": "^8.18.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-prettier": "^4.2.1",
    "jasmine-core": "~4.2.0",
    "karma": "^6.4.0",
    "karma-chrome-launcher": "^3.1.1",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "^5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "prettier": "^2.7.1",
    "prettier-eslint": "^15.0.1",
    "ts-node": "~10.8.1",
    "tslib": "^2.4.0",
    "typescript": "~4.7.4"
  }
}

tsconfig:
{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist",
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "forceConsistentCasingInFileNames": true,
    "esModuleInterop": true,
    "resolveJsonModule": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2017",
    "module": "es2020",
    "typeRoots": ["./types", "./node_modules/@types"],
    "lib": ["es2018", "dom"]
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": false,
    "strictInjectionParameters": true,
    "fullTemplateTypeCheck": true,
    "strictTemplates": true
  }
}

Anything else relevant?

No

no

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17

Most upvoted comments

@alan-agius4 & @fitprotracker

I did a refactoring of all the modules as a standalone component and the project now works.

same problem. When working on a module it shows these errors. This module is the most complex, since it activates cameras and QR readers.

@richardR59 & @fitprotracker can you please provide a minimal reproduction as otherwise I am afraid that we cannot investigate this issue.

@alan-agius4 I think Angular 14 version forces us to use standalone instead of module. It works with angular 13 version