-
Notifications
You must be signed in to change notification settings - Fork 3.1k
add support for "workspaces.nohoist"
and "workspaces.hoistingLimits"
#20124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+453
−126
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated 1:11 PM PT - Jun 3rd, 2025
❌ @dylan-conway, your commit 504b433 has 4 failures in
🧪 To try this PR locally: bunx bun-pr 20124 That installs a local version of the PR into your bun-20124 --bun |
"workspaces.nohoist"
"workspaces.nohoist"
and "workspaces.hoistingLimits"
This pr was reverted and reopened here #20178 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds support for
"workspaces.nohoist"
and"workspaces.hoistingLimits"
inbun install
.closes #6850
"nohoist"
The
"nohoist"
field prevents a package from hoisting if any of the specified patterns match it's package path. The patterns support glob syntax. Example:package.json
pkg1/package.json:
This package.json will prevent [email protected] from hoisting out of pkg1. The transitive dependencies of react are still able to hoist to the root. The result of an install would be:
If you wanted to prevent react and all it's dependencies from hoisting, "pkg1/react/**" could be added to nohoist:
"nohoist": [ + "pkg1/react/**", "pkg1/react" }
An install would create:
"hoistingLimits"
The
"hoistingLimits"
field allows limiting dependency hoisting to workspaces or the direct dependencies of workspaces. There are three valid values:"none"
,"workspaces"
, and"dependencies"
."none"
This is the default value. No limitation, all dependencies are allowed to hoist like they normally are.
"workspaces"
Prevents dependencies from hoisting out of workspaces. Example:
package.json
pkg1/package.json
pkg2/package.json
pkg1 and pkg2 both depend on the same version of react, and setting
"hoistingLimits": "workspaces"
will prevent react and it's transitive dependencies from hoisting beyond their workspaces, resulting in separate copies of these packages. An installs creates:"dependencies"
"dependencies"
does the same as"workspaces"
and additionally prevents transitive dependencies from hoisting beyond direct dependencies. This can be used to prevent phantom dependencies. With the same example with pkg1 and pkg2, an install with"hoistingLimits": "dependencies"
would create:How did you verify your code works?
TODO:
webpack-cli
and"nohoist": ["**"]
hangs