'Angular - Maximum call stack size exceeded

I'm getting an error when I try and do an ng build on an Angular library project. Most likely something is eventually creating/calling itself, but it only fails to build for me. Everything works fine for everyone else on the team. I've looked through all the recent commits, and nothing is jumping out at me as an obvious cause. Is there a command I can run that will help me find the root cause of this?

error message

[error] RangeError: Maximum call stack size exceeded
    at parseNonArrayType (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:30840:28)
    at parsePostfixTypeOrHigher (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:30941:24)
    at parseTypeOperatorOrHigher (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31000:20)
    at parseUnionOrIntersectionType (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31029:20)
    at parseIntersectionTypeOrHigher (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31040:20)
    at parseUnionOrIntersectionType (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31029:20)
    at parseUnionTypeOrHigher (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31043:20)
    at parseTypeWorker (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31134:24)
    at doOutsideOfContext (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:28976:20)
    at parseType (B:\WORK\widgets\node_modules\typescript\lib\typescript.js:31127:20)

Workspace package.json dependencies

 "dependencies": {
    "@angular/animations": "^11.2.4",
    "@angular/common": "^11.2.4",
    "@angular/compiler": "^11.2.4",
    "@angular/core": "^11.2.4",
    "@angular/forms": "^11.2.4",
    "@angular/platform-browser": "~11.2.4",
    "@angular/platform-browser-dynamic": "~11.2.4",
    "@angular/router": "~11.2.4",
    "@types/bootstrap": "^5.0.8",
    "@types/jquery": "^3.5.5",
    "jquery": "^3.6.0",
    "karma-coverage": "^2.0.3",
    "popper.js": "^1.16.1",
    "rxjs": "~6.6.6",
    "tslib": "^2.1.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.1102.3",
    "@angular/cli": "~11.2.3",
    "@angular/compiler-cli": "~11.2.4",
    "@angular/language-service": "~11.2.4",
    "@babel/core": "^7.13.10",
    "@compodoc/compodoc": "^1.1.11",
    "@storybook/angular": "^6.2.9",
    "@types/jasmine": "~3.6.4",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "^14.14.43",
    "babel-loader": "^8.2.2",
    "bootstrap": "^4.6.0",
    "codelyzer": "^6.0.1",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~6.0.0",
    "karma": "~6.1.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~4.0.1",
    "karma-jasmine-html-reporter": "^1.5.4",
    "ng-packagr": "^11.2.4",
    "protractor": "~7.0.0",
    "ts-node": "~9.1.1",
    "tslint": "~6.1.3",
    "typescript": "^4.1.0"
  }

Library package.json dependencies

  "peerDependencies": {
    "@angular/common": "^11.2.11",
    "@angular/core": "^11.2.11",
    "@types/jquery": "^3.5.0",
    "jquery": "^3.5.1"
  },
  "devDependencies": {},
  "dependencies": {
    "jquery": "^3.5.1"
  }


Solution 1:[1]

I had similar issue. The problem was that I was runnig with build flag --configuration production

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Johansrk