yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.23k stars 1.07k forks source link

[Bug]: Yarn doesn't de-dupe patches #6055

Open lukeapage opened 6 months ago

lukeapage commented 6 months ago

Self-service

Describe the bug

I have a patch on reselect and use that directly as well as redux toolkit and redux toolkit wants a version "^5.0.0" and the patch is on 5.0.1.

yarn does not dedupe that it should use the patched version.

To reproduce

yarn add reselect
yarn add @reduxjs/toolkit
yarn patch reselect

and reselect is present in the root and under @reduxjs/toolkit

Environment

yarn crashes running this command due to another bug.

Its windows 10.

Additional context

No response

lukeapage commented 6 months ago

Adding a explicit resolution also makes no difference. Editing the yarn.lock file manually and yarn just reverts the change - so looks like the only work-around is to not use yarn patch.

lukeapage commented 6 months ago

sorry - a explicit resolution does work - I was missing that the resolution needs to be on the root package.json and there were no warnings about using it on a sub-package json.

The work-around to use patch-package isn't available as it does not currently support yarn.

merceyz commented 5 months ago

there were no warnings about using it on a sub-package json.

There is a warning when you run an install, you might have missed it.

lukeapage commented 5 months ago

@merceyz sorry you are right, I somehow missed it for months :(