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?
Asked
Active
Viewed 1,579 times
1
-
You could fork the project and do your changes, but there may be some better practice someone knows. – StackedQ Aug 11 '18 at 06:22
1 Answers
0
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!

Mohsen
- 1,415
- 1
- 13
- 26
-
the problem is that android studio cannot find the modules in that case : Unable to find module with Gradle path ':react-native-spinkit' – pecabum Aug 13 '18 at 09:09
-