Create and apply patches to npm dependencies to fix bugs or make changes without waiting for upstream updates.
patch-package is a Node.js tool that enables developers to fix bugs or make custom modifications to npm dependencies directly in their projects. It generates patch files from changes made in node_modules, which are automatically applied during package installation, allowing teams to share fixes without waiting for upstream updates.
JavaScript and Node.js developers working on applications with npm or yarn dependencies who encounter bugs or need temporary modifications in third-party packages.
Developers choose patch-package because it provides a lightweight, version-controlled way to apply immediate fixes to dependencies, avoiding the complexity of forking repositories or waiting for pull requests to be merged and published.
Fix broken node modules instantly 🏃🏽♀️💨
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows direct edits in node_modules to generate patch files instantly, bypassing wait times for upstream updates. The README demonstrates a quick workflow from editing to committing patches.
Patch files are stored in version control, automatically applied during installation to ensure consistency across all developers and deployments. The README emphasizes committing patches for team sharing.
Supports sequenced patches, partial application, and dev-only patches for complex scenarios, enabling nuanced dependency management. Evidence includes sections on rebasing and multiple patches.
Provides specific guidance for Docker, Heroku, and CircleCI, including cache handling and environment variables, ensuring patches work in automated pipelines. The README details steps for build environments.
Requires an extra postinstall-postinstall package for Yarn v1 to ensure patches apply after yarn remove, adding setup complexity. The README explains this workaround and its necessity.
Long-lived patches can be costly to maintain if the underlying package updates frequently, as noted in the 'Isn't this dangerous?' section, leading to potential rework.
Integrating with CI/CD requires careful cache key management to avoid stale patches, adding overhead. The README warns about cache issues in Docker and CircleCI setups.