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
Is an inner workspace (has workspaces: [] in package.json)
contains n packages
web
is an inner workspace too
contains some web apps, packages etc. all with a matching react, react-query version
The shared dependencies in the web inner workspace should have been hoisted to web, but some dependencies are left as multiple instances in the packages instead (see attached screenshot & reproduction).
## What's the problem this PR addresses?
<!-- Describe the rationale of your PR. -->
<!-- Link all issues that it closes. (Closes/Resolves #xxxx.) -->
Fixes#6493Fixes#6494
## How did you fix it?
<!-- A detailed description of your implementation. -->
Issue: #6493. Sometimes hoisting algorithm was stopped too early,
because it wasn't able to determine correctly stop condition. I made it
safer but possibly one round slower by stopping only when nothing was
hoisted during the last round.
Issue: #6494. Hoisting avoided hoisting to non-root workspace
previously, I have removed this limitation, because it made inner
workspaces meaningless.
## Checklist
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.
<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
Self-service
Describe the bug
Discord ref: https://discord.com/channels/226791405589233664/1283003259937755148
Not related to #6493 but found at the same time as part of the same discussion.
Example monorepo setup:
n
packagesreact
,react-query
versionThe shared dependencies in the
web
inner workspace should have been hoisted toweb
, but some dependencies are left as multiple instances in the packages instead (see attached screenshot & reproduction).To reproduce
Reproduction: https://github.com/iffa/yarn-hoisting-repro/tree/b77e8e2446a62325c847a9595153a1402c9fed30
(Important to view this specific commit SHA)
yarn install
and observenode_modules
directories in the repoEnvironment
System: OS: macOS 14.5 CPU: (10) arm64 Apple M1 Pro Binaries: Node: 20.17.0 - /private/var/folders/00/m6b9k2y13rvgz5dn7y7_dtx00000gn/T/xfs-6c80b460/node Yarn: 4.4.1 - /private/var/folders/00/m6b9k2y13rvgz5dn7y7_dtx00000gn/T/xfs-6c80b460/yarn npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
Additional context
The text was updated successfully, but these errors were encountered: