issue and workaround for react-dom as a peer dependency (yarn 2 with workspaces)
See original GitHub issueWhen using this package with yarn v2 (yarn berry), it throws while building:
Module not found: Error: use-context-selector tried to access react-dom (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
this error comes after resolving #134 by adding scheduler as a dependency 😉 (resolving this error is a bit easier than #134 - so I created another issue, hope this is fine for you)
You depend on use-context-selector, and they declared react-dom
as a peerDependency. So you should also add react-dom
to your peerDependencies to make sure, it is available.
workaround at the moment
Currently workaround is adding this to .yarnrc.yml
packageExtensions:
jotai@*:
peerDependencies:
"react-dom": "*"
info about packageExtensions:
Some packages may have been specified incorrectly with regard to their dependencies - for example with one dependency being missing, causing Yarn to refuse it the access. The packageExtensions fields offer a way to extend the existing package definitions with additional information.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
So, for now our recommendation is the workaround described in https://github.com/pmndrs/jotai/issues/135#issue-723129121
or the one described in https://github.com/pmndrs/jotai/pull/139#issuecomment-710701325
Alright, I wasn’t aware this. Thanks for noting.