I’ve modified an NPM package for my project. How can I stop npm install or update from erasing my changes, while still following best practices?
Considering my experience with customized packages, I found that the most reliable method to preserve changes is to fork the repository and maintain your modified version independently. By referencing your fork in the package.json file, you can continue making adjustments while keeping track of upstream updates. In practice, this means you can cherry-pick updates or incorporate bug fixes from the original package when necessary. This approach has saved me from the frustration of unused local changes and has allowed me to maintain a clear separation between your custom modifications and the standard package updates.