In my package.json
I have a package:
{
"somepackage": "^6.5.1"
}
This package has a dependency (from somepackage
's package.json):
{
"someotherpackage": "^9.4.2"
}
I want to swap someotherpackage to one of its fork.
I know of yarn's Selective dependency resolution
feature, but I guess that is only for different versions of the same package.
I could as well fork somepackage
and change its dependencies manually, swapping someotherpackage
to someotherpackage-fork
, but if there is another way I would take that.
Thanks!
The mentioned selective dependency resolution feature is the way to go. Under the hood it seems to be resolving packages the same way dependencies
does which allows us to do the following:
"resolutions": {
"**/someotherpackage": "npm:someotherpackage-fork@*"
}
You can also specify which version of your fork you want:
"resolutions": {
"**/someotherpackage": "npm:[email protected]"
}
I haven't confirmed if this works for Yarn version 2 yet.
Showcase: https://github.com/dimitarnestorov/yarn-resolutions-showcase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With