-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Self-service
- I'd be willing to implement a fix
Describe the bug
Discord thread ref: https://discord.com/channels/226791405589233664/1283003259937755148
Monorepo with nodeLinker: node-modules
and nmHoistingLimits: none
in root, with a package that contains installConfig.hoistingLimits
set to workspaces
to block its dependencies from being hoisted, can cause a scenario where hoisting from the non-limited packages does not work as expected.
An example setup:
- root (no hoisting limits)
- mobile (hoistingLimits: workspaces)
- uses react 18.2, react-native 0.73.x and react-query 4.x
- web1 and web2
- uses react 18.3 and react-query 5.x
- web-common
- uses react 18.3 and react-query 5.x, depended on by web1 & web2
- mobile (hoistingLimits: workspaces)
In this scenario, all web* packages should have their dependencies hoisted to the root node_modules, and there shoulnd't be multiple instances of e.g. react-query
in the packages' own node_modules - but due to this issue, this is not the case (see attached screenshot & reproduction repository).
To reproduce
Reproduction: https://github.com/iffa/yarn-hoisting-repro/tree/140a2a4f0b4dabc82b6a90477fef37f1e339d7b8
(important to view this specific commit SHA)
Environment
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 20.17.0 - /private/var/folders/00/m6b9k2y13rvgz5dn7y7_dtx00000gn/T/xfs-64e9faf4/node
Yarn: 4.4.1 - /private/var/folders/00/m6b9k2y13rvgz5dn7y7_dtx00000gn/T/xfs-64e9faf4/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
Additional context
