Patching packages in Yarn berry
At one point, patching a package in Yarn was as simple as
yarn patch <package-name> and following the prompts. Now, it’s riddled with unintuitive bugs. Let’s walk through it.
Patching the package
To prepare the package for patching, run
yarn patch <package-name>. The command output should specify a temporary directory for you to edit. Make the desired changes to the package in that directory, then follow the subsequent command in the output:
yarn patch-commit -s <directory>.