DEV Community

Cover image for patch-package: The Lifesaver for both Bleeding Edge and Legacy Projects
Andreas Bergström
Andreas Bergström

Posted on • Edited on • Originally published at andreasbergstrom.dev

patch-package: The Lifesaver for both Bleeding Edge and Legacy Projects

When you need to patch a third-party dependency without forking — bleeding-edge bug nobody's released a fix for yet, or a stuck-on-old-version legacy app — patch-package is the right tool. Edit the file in node_modules, run npx patch-package <name> to capture the diff into patches/, then add "postinstall": "patch-package" so the diff reapplies automatically on every install.

The full post walks through a real React Native + Xcode 14.3 case (a bitwise-operator change in Yoga.cpp), the install/diff/apply flow, and why this matters in both directions of the dependency timeline — patching a dep that ships in 6 months and one that hasn't been touched in 3 years.


Originally published at andreasbergstrom.dev — read the full post there.

Top comments (1)

Collapse
 
popbot profile image
Jarod Wong

Thanks Andreas! Very helpful!