-
-
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
[Feature] Support yarn dedupe --strategy fewer
#2297
Comments
I would use this feature. We use Renovate to pin every package to an exact version so we can test every upgrade. Sometimes a transitive dependency will cause a newer version to be added to the lock file as well. These duplicate dependencies are a common cause of broken tests/builds. I expect We are currently using resolutions as a workaround; for example we define |
Hi, if anyone is interested I forked yarn-deduplicate and made it work with yarn berry. (npm here: https://www.npmjs.com/package/yarn-berry-deduplicate) Usage:
Default strategy is |
Describe the user story
I have a project which uses
next
andnext-offline
as dependencies. The package.json of these two packages are as below:next-offline
haswebpack
in itspeerDependencies
, so I have to also addwebpack
into my project'spackage.json
to avoid the warning from Yarn. Since I don't actually usewebpack
directly and I don't care which version ofwebpack
I'm using, I simply write"webpack": "^4"
inpackage.json
The latest
webpack@^4
version today is4.44.2
, which cause Yarn to install two version ofwebpack
inmy-project
:Install two versions of the same package (not specifically
webpack
) could cause some issues.Describe the solution you'd like
Implement
yarn dedupe --strategy fewer
. This command should update theyarn.lock
above to:I'm using
renovate
to manage my dependencies, which can runnpm dedupe
oryarn dedupe
after every update (docs). This means that I don't have to runyarn dedupe
myself so this is an acceptable solution for me.Describe the drawbacks of your solution
Please let me quota the document from
yarn-deduplicate --strategy fewer
:Describe alternatives you've considered
There is a RFC to fix this kind of issue at #1001 (which has an almost identical example). However, it seems that this PRC hasn't been implemented.
Because we already have
yarn dedupe --strategy highest
.The text was updated successfully, but these errors were encountered: