Welcome to TWIL, our weekly series dedicated to the incremental learnings of complex software development topics. In this week's slice of enlightenment, Emily unpacks the utility of Patching Node Modules in JavaScript, illustrating how developers can address and manage bugs within dependencies efficiently using patch-package
, foregoing the tedium of forking repositories just to make minor adjustments. Join us as we unpack this technique, designed to ensure your dependencies remain in pristine working order with minimal fuss.
Patching Node Modules
Have you ever found an issue in a dependency that had a bug or a small change you needed to make? Usually, my default solution is to fork the repository, commit the change, and then install from my forked repo instead. But there’s a better way!
patch-package
is a library that allows you to store patches and automatically apply them when installing or updating a package. It also supports denoting the library version that the patch was generated for and reminding you to remove the patch if/when the change gets added to the library.
- JavaScript