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

Screenshot 2023-07-24 at 4 06 06 PM

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

Most upvoted comments

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.