I have a React native project which requires to change some code inside the Android project of some library. The problem is that the library is positioned inside the node_modules folder and it's not been saved when pushing to get, because node_modules is ignored. I know I can remove node_modules from .gitignore but I think there should me another way, some better practice?
Best way is that customize your module and use it from another address! for example I written many module and saved them like this :
./rootOfProject
./node_modules
./custom_modules <-- here!
Note : In your android folder you need some changes! for example,
from :
project(':react-native-someModules').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-onesignal/android')
to :
project(':react-native-someModules').projectDir = new File(rootProject.projectDir, '../custom_modules/react-native-alarm-manager/android')
But why is this common solution?
Usually node_modules
size is very large and it's not good to upload this to git or copy paste from a system to another, and for solve this problem, npm save module name's in package.json
and everywhere that you want can run npm i
and get node_modules!