-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Lack of more granular hoisting (former "nohoist") prevents me from upgrading from Yarn 1.x to 3.x #3273
Comments
@Rush I assume, you are using If you want to disable hoisting for only a few packages, you can just make the name busy on the higher level, for instance by using an alias, or
or
This way the nm linker will have no chance to hoist |
This is so useful! I have a project with 2 workspaces and dependencies:
Yarn ends up installing it like:
React Router v6 includes the types in it, while v5 had a With the solution above, I added at the root: "devDependencies": {
"@types/react-router-dom": "portal:./packages/noop"
}, and a simple
The v5 types don't leak out! |
If you use the |
The approximation of my monorepo setup:
monorepo/package1 depends on:
@angular/core
mongoose
what's special about
package1
is that it can either be used standalone, or as a dependency forpackage2
monorepo/package2 depends on:
@angular/core
mongoose
With yarn 1.x I use:
But if I undestand Yarn 3.x, I can either have my direct dependencies hoisted by default or not hoisted at all (
hoistingLimits
set to"workspaces"
)The problem is with the same repo, I need the behavior of:
mongoose
never being hoisted. Unfortunately mongoose is a stateful package wheremongoose.model
registers information in package's local state.package1
andpackage2
need separate state stored inmongoose
.@angular/**
always being hoisted. There cannot be two versions of angular as it relies on strict equality between DI tokens. One cannot inject a token from one angular tree and expect a dependency resolved from the injector created in another tree.Unfortunately I had to revert to yarn
v1.x
but I hope more granular hoisting can be made possible with future yarn versions. I realize it's possibly an edge case, but for me it's a real one.The text was updated successfully, but these errors were encountered: