swimlane / ngx-charts

:bar_chart: Declarative Charting Framework for Angular
https://swimlane.github.io/ngx-charts/
MIT License
4.28k stars 1.15k forks source link

Error: Error on worker #1: RangeError: Maximum call stack size exceeded #1636

Closed hgschwibbe closed 2 years ago

hgschwibbe commented 3 years ago

Describe the bug After adding @angular/cdk 11.2.13 and ngx-charts to the project npm install does not work anymore.

To Reproduce Steps to reproduce the behavior:

  1. npm install --save @angular/cdk@11.2.13
  2. npm install --save @swimlane/ngx-charts@18.0.1
  3. npm install
  4. See error
    Compiling @swimlane/ngx-charts : es2015 as esm2015
    Compiling @swimlane/ngx-charts : main as umd
    Error: Error on worker #1: RangeError: Maximum call stack size exceeded
    at resolveNameHelper (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:44875:35)
    at resolveName (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:44873:20)
    at resolveEntityName (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:46147:42)
    at getSymbolOfNameOrPropertyAccessExpression (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:77578:28)
    at getSymbolAtLocation (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:77647:28)
    at Object.getSymbolAtLocation (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/typescript/lib/typescript.js:43738:31)
    at UmdReflectionHost.findUmdImportParameter (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:341:45)
    at UmdReflectionHost.getImportPathFromParameter (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:424:40)
    at UmdReflectionHost.getUmdModuleDeclaration (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:412:35)
    at UmdReflectionHost.getDeclarationOfIdentifier (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:54:70)
    at ClusterMaster.onWorkerMessage (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
    at /home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
    at ClusterMaster.<anonymous> (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
    at step (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:143:27)
    at Object.next (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:124:57)
    at /home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/tslib/tslib.js:113:16)
    at EventEmitter.<anonymous> (/home/hgsch/sourcecode/beratungsrechner-frontends/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
    at EventEmitter.emit (events.js:376:20)

Additional Information I found a similar bug report for another @swimlane project (@swimlane/ngx-datatable), probably both are related to each other: https://github.com/swimlane/ngx-datatable/issues/1676

medi6 commented 3 years ago

Hi, I've got the same problem, with Angular 12.0.4...

jpduckwo commented 3 years ago

Same problem... took me ages to track down the culprit!

ibenjelloun commented 3 years ago

Same here :

"@angular/animations": "^12.0.0",
"@angular/cdk": "^12.0.4",
"@angular/common": "^12.0.0",
"@angular/compiler": "^12.0.0",
"@angular/core": "^12.0.0",
"@angular/forms": "^12.0.0",
"@angular/material": "^12.0.4",
"@angular/platform-browser": "^12.0.0",
"@angular/platform-browser-dynamic": "^12.0.0",
"@angular/router": "^12.0.0",
"@swimlane/ngx-charts": "^18.0.1",

The only workaround that worked for now is :

ozkoidi commented 3 years ago

Same problem here. The only thing that worked for me was to create a ngcc.config.js file as suggested by d-rybachuk in issue #1623. I hope they release a fix for this soon.

Crocsx commented 3 years ago

Same problem here, this looks critical indeed, I just installed this package, looked pretty cool, but it crash in my pipelines as npm i will always fail... but yeah duplicate of #1623

Tea-Ice commented 3 years ago

There any updates for this? Bypassing ngcc isn't a fix.

kiwidude68 commented 2 years ago

Same issue for me too, took ages to track this down. Going back to ngx-charts 17.0.1 worked around the issue for me so it is at least possible to build clean, but 18.0.1 was a definite no-go.

AmirSavand commented 2 years ago

+1

seanlawrenz commented 2 years ago

+1

The ngcc.confige hack is not a fix, as those modules are part of testing. Bypassing the umd builds makes jest unable to find the module and fails with no solution.

neffsvg commented 2 years ago

issue still present after upgrading to version 19.0.0

added ngcc.config.js to root folder (as mentioned earlier) to "solve" the issue, containing:

module.exports = {
    packages: {
        '@swimlane/ngx-charts': {
            entryPoints: {
                '.': { override: { main: undefined } },
            },
        },
    },
};
jpduckwo commented 2 years ago

Thanks @neffsvg - saved me some time testing...

This is now really annoying because we can't upgrade our Angular version until this issue is fixed. Something must have changed in the package build process to cause this. Does anyone know what specifically is missing in the npm package that causes it to break?

Cheers

marjan-georgiev commented 2 years ago

Is anyone able to create a repository where this can be reproduced, please? I'm having trouble reproducing it.

Hypercubed commented 2 years ago

@marjan-georgiev https://github.com/Hypercubed/ngcc_error/tree/main

Throws the error when running npx ngcc

juergenr commented 2 years ago

Hi @marjan-georgiev,

I'm using Angular CLI: 12.0.5 Node: 14.17.5 Package Manager: npm 6.14.14 OS: win32 x64 typescript: 4.2.4 (I do not thing the versions are important - I had similar behavior with other versions)

here are the steps to reproduce the error on a minimal setup:

  1. ng new test-ngx-charts cd test-ngx-charts
  2. edit package.json add to stripts: "postinstall": "ngcc" add to dependencies: "@angular/cdk": "~12.0.1", "@swimlane/ngx-charts": "~19.0.0"
  3. npm install => produces the error: Compiling @swimlane/ngx-charts : main as umd Error: Error on worker #1: RangeError: Maximum call stack size exceeded ....

Thanks for looking into the error!

jpduckwo commented 2 years ago

Fixed for me with 19.0.1 thanks

juergenr commented 2 years ago

Working. Thanks!