Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded on build after installing @nivo/radial-bar": "^0.83.0 #2353

Open
LironHazan opened this issue May 30, 2023 · 19 comments

Comments

@LironHazan
Copy link

Hey!
I just started to use Nivo :) and not sure why, but after installing:
@nivo/radial-bar": "^0.83.0"
I cannot bundle to prod with vite, getting a tsc error,
it didn't happen when installed
"@nivo/line": "^0.83.0",
I also have

        "@nivo/bar": "^0.83.0",
        "@nivo/core": "^0.83.0",
> tsc && cross-env NODE_OPTIONS=--max-old-space-size=8192 P_ENV=production vite build

/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:96888
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at Object.isPartOfTypeNode (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:11786:30)
    at containsReference (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:52596:53)
    at visitNode (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:24472:24)
    at Object.forEachChild (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:24621:24)
    at containsReference (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:52607:29)
    at visitNode (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:24472:24)
    at Object.forEachChild (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:24657:24)
    at containsReference (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:52607:29)
    at visitNode (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:24472:24)
    at Object.forEachChild (/Users/lironhazan/dev/cloud-apps/services/dashboard/client/node_modules/typescript/lib/tsc.js:24640:24)


using typescript version: "typescript": "^4.5.4",
npm 8.19.3 + node v16.19.1

Will really appreciate any advice

@LironHazan
Copy link
Author

@plouc Hey I hope it's ok I'm tagging you, appreciate your effort,
Do you have any lead on why this could happen?

@echarles
Copy link

Same issue here with compiling with tsc. Works fine with webpack devserver but fails when with tsc. Will need to look to another lib for now...

@plouc
Copy link
Owner

plouc commented Jun 26, 2023

@LironHazan, I don't know what could cause that, it would need to be investigated.

@LironHazan
Copy link
Author

Thanks, I'm looking into more charts of Nivo, will update if see more issues of if I'll have a lead of the root cause

@LironHazan
Copy link
Author

@plouc impressive work on the make file! :)
I've tried to look into the way the lib is built and couldn't find mention to any active typechecking in the rollup config,
I'm not an expert in rollup but maybe using @rollup/plugin-typescript would add the typechecking phase and help tracing such issues?

@Xantier
Copy link

Xantier commented Jul 4, 2023

This looks to be introduced somewhere in version 0.81.0.
Dependencies

    "@nivo/bar": "^0.80.0",
    "@nivo/core": "^0.80.0",
    "@nivo/pie": "^0.80.0",

Compile properly, though additional type dev dependencies need to be added in:

    "@types/d3-scale": "^4.0.3",
    "@types/d3-color": "^3.1.0",
    "@types/d3-scale-chromatic": "^3.0.0",

Bumping @nivo/ deps to 0.81.0, we'll hit the typescript error (due to some introduced recursive typing?)

@LironHazan
Copy link
Author

@Xantier I can't downgrade, it causes other conflicts in the project
Any chart with arcs has the issue, so far we tested:

Pie Chart
Sunburst Chart
Radial Bar Chart

@benellatalon
Copy link

The errors seems to be coming from @nivo/arcs

@plouc
Copy link
Owner

plouc commented Jul 6, 2023

@plouc impressive work on the make file! :) I've tried to look into the way the lib is built and couldn't find mention to any active typechecking in the rollup config, I'm not an expert in rollup but maybe using @rollup/plugin-typescript would add the typechecking phase and help tracing such issues?

Thank you 😊 The type checking is done via pkgs-types, and it's run on CI via:

pkgs-build: pkgs-types ##@1 packages build all packages

Initially @rollup/plugin-typescript didn't support type checking, that's why I used another approach.

@Xantier
Copy link

Xantier commented Jul 6, 2023

Here is a minimal reproduction: https://github.com/Xantier/nivo-ts-stackoverflow

@Xantier
Copy link

Xantier commented Jul 6, 2023

Flipping around version on the minimal reproduction, this actually looks to work on 0.81.0 version as well. 0.82.x doesn't build at all so my assumption is that the issue was introduced in 82 or 83

@Jule-
Copy link

Jule- commented Jul 29, 2023

Hi, same issue here.

I have debugged tsc and it crashes when evaluating this file: @nivo/arcs/dist/types/centers.d.ts.

In fact, when you look at it there is a loooooot of import stuff from @react-spring/*, I am pretty sure this is what is killing the stack.

Can you see a quick fix or workaround for this? 😬

@Jule-
Copy link

Jule- commented Jul 29, 2023

I think this issue appears due to: #2280 (released in v0.82.0)

@Jule-
Copy link

Jule- commented Jul 29, 2023

Unfortunately downgrading @react-spring/[email protected] is not enough, maybe a false lead... I think the generation of the centers.d.ts file should be responsible for this issue.

const transition = useTransition<
Datum,
{
progress: number
startAngle: number
endAngle: number
innerRadius: number
outerRadius: number
} & ExtraProps
>(data, {
keys: datum => datum.id,
initial: phases.update,
from: phases.enter,
enter: phases.update,
update: phases.update,
leave: phases.leave,
config: springConfig,
immediate: !animate,
})

Maybe if you can type the transition property with a less wordy type than the one generated it could help tsc to compile. And I am not sure if/how we should report this to the @react-spring/web project.

@Jule-
Copy link

Jule- commented Jul 29, 2023

Same issue here:

const transition = useTransition<
Datum,
{
progress: number
startAngle: number
endAngle: number
innerRadius: number
outerRadius: number
} & ExtraProps
>(data, {
keys: datum => datum.id,
initial: phases.update,
from: phases.enter,
enter: phases.update,
update: phases.update,
leave: phases.leave,
config: springConfig,
immediate: !animate,
})

Copy link

stale bot commented Dec 15, 2023

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Dec 15, 2023
@Jule-
Copy link

Jule- commented Dec 15, 2023

bump

@acrylicode
Copy link

The issue is still there. For anyone interested, I deleted the types folder before running the tsc and it works.
So under node_modules/@nivo/bar there is a types folder. Just delete that. Do the same for all the charts you are using. If you want to get fancy you can wrap the tsc in another command that automatically deletes the types, executes tsc and then reinstalls it again.

@stale stale bot removed the stale label Jan 29, 2024
@HendrikGrobler
Copy link

Bump. This issue is prevent us from using Nivo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants