nivo: 0.83.0 Doesn't work with pnpm + webpack
Describe/explain the bug When using 0.83.0 with wepback + pnpm, something goes wrong in the dep tree, and the result is that all the Container.js contexts hooks produce undefined values wherever they are called, resulting in lots of runtime errors and blank charts.
Runtime Errors are like
Cannot read properties of undefined (reading 'animate')
TypeError: Cannot read properties of undefined (reading 'animate')
To Reproduce
Does not reproduce using npm, but switching this repo from npm
to pnpm
reproduced it immediately.
https://github.com/ollwenjones/nivo-0830-test
Expected behavior Since nivo uses pnpm internally (per contributing page) one would expect it to work with pnpm
Screenshots
Desktop (please complete the following information):
- OS: Building on Mac OS or Windows, doesn’t matter here.
- Node 16, pnpm 17, webpack 5 (setup per Create React App)
- Browser: Chrome
- Version 114.0.5735.198
Additional context Really tried to solve this, and will contribute a fix if I can figure it out, but had to timebox it. My guess is some dependency problem caused by pnpm isolating modules is being masked by these react-contexts-are-blank runtime errors. Tried to find a duplicate version of React, but was unable to in the time that I had.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 10
- Comments: 18 (7 by maintainers)
Commits related to this issue
- Add peer dependencies of `@nivo/core` as its dependencies in `.yarnrc.yml` * Fixes plouc/nivo#2401 (for whatever reason) Signed-off-by: Marvin A. Ruder <signed@mruder.dev> — committed to marvinruder/rating-tracker by marvinruder 4 months ago
- Update nivo monorepo to v0.84.0 (#1094) * Add peer dependencies of `@nivo/core` as its dependencies in `.yarnrc.yml` as a workaround for plouc/nivo#2401 (no idea why this works) Signed-off-by: Mar... — committed to marvinruder/rating-tracker by renovate[bot] 4 months ago
- fix(dependencies): fix peer dependencies (#2528) * Fix (peer) dependencies * Declare `prop-types` as a dependency of `@nivo/core` (as recommended in their README) * Declare `react` as a peer depe... — committed to plouc/nivo by marvinruder 4 months ago
Same issue here. Getting a lot of undefined errors around the useMotionConfig() hook.
@marvinruder this is a great insight into the problem. Thank you for the time spent digging into this!
I’ve hit that too. Exactly same symptoms, within a nextjs 13 (.4 and .5) application. Stack uses typescript as well (bundler module resolution). Switching to npm fixed it, but led me into a conendrum of trying to adjust our yarn/pnpm monorepo into an hybrid.
Gave up and decided of not using nivo on this project for now as we’re still prototyping.
Really interested to get to the bottom of it and subscribed to the issue.