patch-package can bail you out of some bad situations
Let’s say you’re running some web application and suddenly you hit a bug in one of your dependencies. It’s all deployed, lots of people are seeing the downtime, but you can’t just push an update because the bug is in something you’ve installed from npm.
Remember patch-package. It’s an npm module that you can install in which you:
- Edit the dependency source code directly in node_modules
npx patch-package some-package
"postinstall": "patch-package"to your scripts
And from now on when
npm install runs, it tweaks and fixes the package with a bug. Obviously submit a pull request and fix the problem at its source later, but in times of desperation, this is a way to fix the problem in a few minutes rather than an hour. This is from experience… experience from earlier today.