Reputation: 35
I want to edit and remove some rows of code's from my node-modules but everytime I 'nmp install' my code will be overwriten. Is there a solution to edit files in my node-modules without overwriting them every time?
For example i wanna edit:
underlayColor: 'black',
from react-native-collapsible (A component I installed in react-native) to:
underlayColor: 'yellow',
Right now when I npm install it will be black again.
Upvotes: 2
Views: 3934
Reputation: 989
You shouldn't be editing code in node-modules, because it will get overwritten. If you really want to overwrite the code then you'll need to fork the module and publish the modified source yourself. I don't think you want to do this.
Just from a quick look at the documentation for react-native-collapsible, there is an underlayColor
prop on the Accordion
component (that I'm assuming) you're using, can you not just set the colour by passing your desired colour into that prop when you render the component.
<Accordion
...
underlayColor='yellow'
/>
Upvotes: 1
Reputation: 150
You can fork the module and change code there in your forked repository. And then you can add this module to the package.json file. You can just put the Github repository URL in the package.json file. so you will have own version of the module.
Upvotes: 0
Reputation: 1009
Yes, but not directly,
U gotta fork the repo, make the changes, compile it, commit and push to your repo, npm install from that repo.
Still i would suggest to find a way to configure it, (example: eslint use .eslintrc, karma use karma.config.js, etc)
Upvotes: 1