-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Native Packager - Module replacement? #2
Comments
Im not sure why, but utilizing the react-native-webpack-server's example this works properly, but not when with a react native generated template and following their readme. Tracking here mjohnston/react-native-webpack-server#75 For now, Ive added an example based on their example thats working great. |
react-native-webpack-server seems poorly supported now, and react is holding steadfast on their packager. |
This was solved (I dont know what release) by using the default packager and the browser field in package.json
|
Current packager only alias's one level deep it would seem. So we can use var noble = require('noble') in our main file, but if we var Bean = require('ble-bean'); which does its own noble require, it fails out because its trying to us actual noble :( |
Here is the current issue that is asking for global aliasing. Please bump |
I have a PR in with preliminary deep shim support facebook/react-native#9899 PRs and help wanted. Also it seems like theres a lot of movement around rn-nodeify, a nifty hack rewriting files locally in order to get around fixing the react native packager. Ive favored this solution in the readmes for now while I continue to work on my solution |
"The React Native Packager has a built-in option, extraNodeModules, which seems to act as a module alias mapping. I couldn't find much information about this option, but here's the PR where it was added: facebookarchive/node-haste#69. Here's my rn-cli.config.js:" |
Another day another set of options. I found https://github.com/tleunen/babel-plugin-module-resolver which should allow something like
However in practice it also recursively rewrites react-native-ble itself so the noble/with-bindings becomes react-native-ble/with-bindings ... Otherwise @phated has a concept for using the metro field in package.json here
Then pushing these bindings directly inside of noble and then adding to nobles package.json
which could swap in resolve-bindings.ios.js or resolve-bindings.android.js if we move all this code upstream. Though noble needs cross platform code changes swapping events/ and inherits instead of util and events |
Oh odd.. you actually dont need any of the metro/react-native key stuff in either project, itll automatically pick up the bindings because noble doesnt specify an extension here |
Im not sure how/if module replacement is supposed to work in react packager. Or maybe we need to look into https://github.com/mjohnston/react-native-webpack-server ?
For now Im (sadly) editing files manually
But its a deep rabbit hole. The eddystone-url-encoding module does a json require without specifying the extension which the react native packager doesnt seem to support
The text was updated successfully, but these errors were encountered: