Skip to content

patching packages

JC Franco edited this page Dec 3, 2024 · 2 revisions

tags: [conventions, dependency, npm, patch, upstream]

Patching packages

When working with external dependencies, it’s not unusual to encounter bugs or missing features while working on milestone issues. If the fix or feature is straightforward, we can patch it locally to avoid blocking progress.

To do this, we use patch-package to apply patches in our releases. Please follow their usage steps to create and include a patch.

Additionally, it’s a best practice to notify the dependency maintainers by opening an issue or submitting a PR. This helps us remove patches in the future and rely on the upstream version.

Notes

  • Patching should be done sparingly, as they introduce maintenance overhead, especially when dependencies are updated.
  • Patches should be placed in the top patches directory.
  • patch-packages's README also has additional great information, including updating and applying patches.

Examples