angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open avarndell opened this issue 3 years ago • 10 comments

🐞 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

avarndell avatar Jul 18 '22 20:07 avarndell

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

alan-agius4 avatar Jul 19 '22 07:07 alan-agius4

I get the same problem, after I separated my code into modules

Capture d’écran 2022-07-21 215615

richardR59 avatar Jul 21 '22 22:07 richardR59

I get the same problem. I am using Nx with libraries. Been running fine update until I did a manual rename of the Nx lib project. After that, it is broken with the same messaging.

I have removed the Nx lib project, then run again and it works. But I create a new Nx lib project, it throws the error once I add it to the main app.

image

fitprotracker avatar Jul 26 '22 22:07 fitprotracker

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

alan-agius4 avatar Jul 27 '22 05:07 alan-agius4

@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

richardR59 avatar Jul 27 '22 23:07 richardR59

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

SebaInfante avatar Jul 28 '22 01:07 SebaInfante

Same error when code-splitting.

codepip55 avatar Jul 29 '22 12:07 codepip55

@richardR59, standalone components are on opt-in base.

A minimal reproduction is required to investigate this issue.

alan-agius4 avatar Jul 29 '22 14:07 alan-agius4

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

@alan-agius4 I ended up removing the nx lib project and starting from scratch. I think what happened was some sort of circular reference. so I imported my project one by one and was able to get it to work.

I think it does have something with an import in the lib project and the main app module with circular reference that caused it.

fitprotracker avatar Jul 29 '22 15:07 fitprotracker

@alan-agius4 & @fitprotracker

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

richardR59 avatar Aug 01 '22 01:08 richardR59

I get the same problem. I am using Nx with libraries. Been running fine update until I did a manual rename of the Nx lib project. After that, it is broken with the same messaging.

I have removed the Nx lib project, then run again and it works. But I create a new Nx lib project, it throws the error once I add it to the main app.

image

Circular reference in one more modules import

kwesiandy avatar Aug 04 '22 21:08 kwesiandy

I'm sorry, but we can't reproduce the problem following the instructions you provided. Remember that we have a large number of issues to resolve, and have only a limited amount of time to reproduce your issue. Short, explicit instructions make it much more likely we'll be able to reproduce the problem so we can fix it.

If the problem persists, please open a new issue following our submission guidelines.

A good way to make a minimal repro is to create a new app via ng new repro-app and add the minimum possible code to show the problem. Then you can push this repository to github and link it here.

alan-agius4 avatar Aug 08 '22 09:08 alan-agius4

Hello sir @alan-agius4 facing this issue where i can able to run the same application successfully in Machine-1 without any webpack build issue , but in my machine-2 when i try to run getting this in terminal

./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): Error: Cannot resolve type entity i7.FontAwesomeModule to symbol

./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js): Error: Cannot resolve type entity i7.FontAwesomeModule to symbol

Webpack version : @angular-devkit/[email protected]

uibhanu5 avatar Sep 01 '22 12:09 uibhanu5

@uibhanu5 Hello Bhanu, were you able to resolve this issue ? If yes, Can you able to help me out with the solution - i am seeing this issue in my local as i am trying to upgrade the angular version to 14.2.2

DundinathG avatar Sep 27 '22 19:09 DundinathG

@uibhanu5 Hello Bhanu, were you able to resolve this issue ? If yes, Can you able to help me out with the solution - i am seeing this issue in my local as i am trying to upgrade the angular version to 14.2.2

https://github.com/angular/angular-cli/issues/23597#issuecomment-1200565037

richardR59 avatar Oct 05 '22 08:10 richardR59

There was an issue with one of my components.

avarndell avatar Oct 05 '22 10:10 avarndell

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.