'Making changes to an installed node package?

I have an external node package installed in my project. It does 90% of what I want but I'd like to make some changes to it. I don't want to submit a PR to developer since these changes are unique to my situation and would only be used by me. What would the best way to go about this? Inside my node_modules folder, the JS file of the library is minified so it's hard to make out anything or edit anything in a coherent manner.



Solution 1:[1]

You shouldn't be really messing about with the node_modules folder, as the code is usually minified (as you have stated).


However, the most reasonable approach to do is to follow the steps below.

  1. Fork the repository on GitHub, and add whatever changes you need to add in the forked repository.

  2. If you want, you can make a new npm module (if you have an account), and install that in your project.

    Otherwise, you can just add it as a folder in your project, or something like that.

Make sure that this isn't overkill for your project!


In conclusion, you shouldn't make changes to the node_modules folder, but you can fork the repository as an alternative.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1