javascriptreactjsreact-nativemetro-bundlercreate-react-native-app

How can I create a "react native" library in Windows that is developed locally?


Initially, I want to check it out and develop it using the example project of RNApp before publishing to the NPM a package for the RN library. Well, in order to do this, it is necessary to place in the example test project and inside the metro config in the blacklist containing the node_modules for the library, ie node_modules/react-native section in the blacklist. It does not interfere with project modules at runtime. I'm unable to determine the path in Windows so that the regex address for the folder is not executed, but I can put /node_modules/. With this, when practically running, none of the project's Node_modules is used and naturally should be. The main problem is the characters \ and / for addressing and determining the path so that even using the path.esolve problem remained. I've got the whole internet and Github and StackOverflow for the three days, but I did not find a way. Problems also apply to Linux and mac altogether. Before I need to install macOS or Linux subsystem for this, Introduce me to be able to solve this conflict between projects.

└───my-library
    ├───example
    │   │   metro.config << (1)
    │   │
    │   └───node_modules
    │       └───react-native
    └───node_modules
        └───react-native << (2)

The structure of my project is in the form above and I want to use the metro.config in section (1) to put the entire internal contents of the directory in section (2) into its blacklist.


Solution

  • Most likely, the packages that react will introduce into this documentation will be two years old which has not been updated, and may have been abandoned. To solve this problem, I used the module simulator and the problem was solved.