-
Notifications
You must be signed in to change notification settings - Fork 930
Description
Describe the Feature
I am currently on a project that is inheriting the native modules and components from another React Native project. Due to constraints, we cannot simply fork the other project and have been forced to re-declare the native modules required for the components we are importing into our own package.json. I have since found a solution that involves installing the other project as a dependency in our package.json and then using patch-package to modify the config loader to look into the other project's package.json. I would love for there to be first-class support for these kinds of situations.
Possible Implementations
Modifying loadConfig
This is what my current solution does. It adds an additional call to findDependecies after this and passes in the other project's root directory. Of course for this to be a feature for this package, a more generic function should be made. It could be configurable in the config file to only traverse sub-dependencies through certain packages. Alternatively to a new function, findDependencies could be altered to support this traversal (or be wrapped and replaced by the traversal function).
User config file based on config command
This would require little to no changes in the code of this package. This is what I was attempting to do but ultimately failed at due to complications which appear will be addressed soon in upcoming versions. I tried to programmatically run react-native config in the other project and then return the dependencies from the output in a react-native.config.js file in this project's root. Unfortunately, the config file from disk is being passed through a validator which does not appear to be in step with the output of the config command, as the config command can display a null value for podFile, while the validator disallows it. This does appear to be fixed in #1537, so perhaps once that is included in a mainline version of this package, I will be able to use this method without the validator complaining.
Related Issues
#1537 fixes validator issues I was experiencing when trying to build a solution to this on my end