patch-package
patch-package copied to clipboard
Yarn vendored packages impossible to patch
Hello, we have packages provided to us through private repository, the package itself is not owned by us. We add this with "file:" protocol of yarn:
{
"dependencies": {
"shim": "file:./vendor/shim-0.1.23.tgz"
}
}
When we try to patch this package with yarn patch-package shim
it returns the following error:
error
Package "" refers to a non-existing file '"/private/var/folders/kh/kgqx507n5b31w3676tsvkw3r0000gn/T/tmp-2705AUL26tJlAvfk/vendor/shim-0.1.23.tgz#73c29517ef20deb521e83f38b931a7d09fabdfbc"'
.
I've managed to overcome this issue manually, with:
- put a breakpoint to line which corresponds to https://github.com/ds300/patch-package/blob/fbbeccd3025451d862b2b8786215e8fd111bec5a/src/makePatch.ts#L109
- Run vscode in debug mode, so breakpoint would trigger
- copy "vendor" folder to the
tmpRepoNpmRoot
- edit package.json file in
tmpRepoNpmRoot
to remove this fancy ending#73c29517ef20deb521e83f38b931a7d09fabdfbc
- continue execution
So, for yarn managed projects we need to copy files itself along with package.json creation. Could this be implemented in patch-package itself?
Not sure if related, but I have a vendored package in resolutions
field and it makes it possible to patch any packages. I can try to patch package A
and it will complain about not being able to find vendored package B
which is completely unrelated.
I've tried resolutions
and it still fails with file not found.