nivo
nivo copied to clipboard
Peer dependency chain break when using yarn PnP
Describe/explain the bug When using nivo with yarn PnP, it detects a peer dependency error in multiple nivo packages.
Module not found: Error: @react-spring/web tried to access react-dom (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
Required package: react-dom
Required by: @react-spring/web@virtual:e8c6662d9f78e41ff789a28882111350ff5b64c3c794140fe7d01b34d06873f67095ca85dab6b6c9721116a1d2f2c5c8c4eb217f2440fbde8a3b5f9ef602ee80#npm:9.3.1 (via /drone/src/.yarn/__virtual__/@react-spring-web-virtual-3d46070674/0/cache/@react-spring-web-npm-9.3.1-60971e196c-223ce3f849.zip/node_modules/@react-spring/web/dist/)
Ancestor breaking the chain: @nivo/annotations@virtual:35d44cfec8561a797578e823be1fd096acd3df9fc3a4e4b4c80f073c7526baf09ab7c08aeabd68e0c5bb844a46dd175777dcf65c56ed77892b901003e8958493#npm:0.79.1
Ancestor breaking the chain: @nivo/arcs@virtual:5193e94f9222e16f5b856787ff397f36674e24498feb1122bfefc7f678d0294512c05edbb989dd133701c225c88477fbe74421f02e0a28522619076847d07ede#npm:0.79.1
Ancestor breaking the chain: @nivo/axes@virtual:35d44cfec8561a797578e823be1fd096acd3df9fc3a4e4b4c80f073c7526baf09ab7c08aeabd68e0c5bb844a46dd175777dcf65c56ed77892b901003e8958493#npm:0.79.0
Ancestor breaking the chain: @nivo/core@virtual:39a864ede30edfae2e2ba7d0802407e9c2507af99f488a2b4ab24b831e07f4dfc8d9b9c2bc8344d0e497fe2781e197d33ae2bf11687188b4b418654d3b798461#npm:0.79.0
Ancestor breaking the chain: @nivo/line@virtual:39a864ede30edfae2e2ba7d0802407e9c2507af99f488a2b4ab24b831e07f4dfc8d9b9c2bc8344d0e497fe2781e197d33ae2bf11687188b4b418654d3b798461#npm:0.79.1
Full log output can be found here: https://drone.mauz.io/MauriceNino/dashdot/148/1/3
To Reproduce
Check out https://github.com/MauriceNino/dashdot, switch to branch feature/yarn_pnp and run yarn && yarn build.
Additional context react-spring has a peer dependency to react-dom, so you should forward it, or install it.
Anyone solve this? In my case,react-dom was already installed but it has still occurred... 🥲
I have switched to recharts which has way better performance, ...but then I ditched PnP afterwards anyways. It's just not ready to be used in semi-big projects.
This is a workaround via.yarnrc.yml and works for 0.78.0 (last minor version). You'll need to run yarn again after changing this:
# .yarnrc.yml
packageExtensions:
"@react-spring/web@*":
dependencies:
react-dom: "*"
Unfortunately the latest Nivo 0.79.0 has other Yarn pnp related errors which I haven't been able to workaround - #1941 and #1951, just a heads up.
Whoo! Working for me with the 2 workarounds mentioned above (https://github.com/plouc/nivo/issues/2014#issuecomment-1187274131) and in #1941 (https://github.com/plouc/nivo/issues/1941#issuecomment-1214948100)
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!
bump
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
I'm trying to address this issue in https://github.com/plouc/nivo/pull/2313.