You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two projects, first one references react and react-dom 16.* and second one references react and react-dom 17.*. react-dom has peer dependency to react. Both projects are inside workspace root folder. After executing yarn install from workspace root there is following structure;
As a result when referencing react-dom it loads its own local version of react, which results in hard to error. On yarn's website there is mention that yarn installs all dependencies, but according to for example issue #1503 yarn does not install peer dependencies. I'm using yarn 1.22.10 - please explain how peer dependecies are handled in yarn?
The text was updated successfully, but these errors were encountered:
Yarn doesn't install peer dependencies for you, you need to install those yourself. Your "filetree" doesn't make much sense, please use something like https://tree.nathanfriend.io/ to create one that does.
I'm assuming you have two workspaces both depending on different versions of react but depending on each other, that wont work unless you're using Yarn PnP as node_modules can't represent that on disk
Here is reproducible repo https://github.com/padzikm/yarn-test - main node_modules includes react-dom, which has its own version of react in its node_modules, despite having react as peer dependency. According to @merceyz answer yarn should not install peer dependency, so there shouldn't be react in react-dom's node_modules. Why it is?
I have two projects, first one references react and react-dom 16.* and second one references react and react-dom 17.*. react-dom has peer dependency to react. Both projects are inside workspace root folder. After executing yarn install from workspace root there is following structure;
first /
node_modules /
empty
second /
node_modules /
react 17.*
node_modules /
react 16.*
react-dom /
node_modules /
react 17.*
As a result when referencing react-dom it loads its own local version of react, which results in hard to error. On yarn's website there is mention that yarn installs all dependencies, but according to for example issue #1503 yarn does not install peer dependencies. I'm using yarn 1.22.10 - please explain how peer dependecies are handled in yarn?
The text was updated successfully, but these errors were encountered: