#5281·berry

[Feature] Allow patch-commit on node_modules folder

Author: eps1lonCreated Feb 18, 2023Updated Aug 19, 2026
Labelsenhancement
  • I'd be willing to implement this feature (contributing guide)
  • This feature is important to have in this repository; a contrib plugin wouldn't do

Describe the user story

Assuming node-modules linker. Coming from Yarn v1 and oftentimes using patch-package, the new workflow of the yarn patch + yarn patch-commit flow is not very ergonomic for my common use cases.

Patches are usually a last resort fix that are applied while debugging. For that, I oftentimes edit files inside node_modules until the code behaves as I want it to do. Once everything is working as intended, I ran yarn patch-package <package-locator>. This is not possible with Yarn Berry. Instead, I have to remember which files I changed, run yarn patch <package-locator>, copy every change over manually, and then run yarn patch-commit.

Intuitively, I just tried to run yarn patch-commit node_modules/<package> but that is rejected with "The argument folder didn't get created by 'yarn patch'".

Describe the solution you'd like

These are alternates:

  1. Allow yarn patch-commit node_modules/<package>
  2. yarn patch <package-locator> --in-place which uses node_modules/<package> instead of a temp directory

Describe the drawbacks of your solution

Coupled with the node-modules linker.

Describe alternatives you've considered

Writing a plugin that I have to teach to co-workers to use instead of yarn patch.