-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Is it possible to use replacement module with Packager? #4018
Comments
Yes, "browser" field should already be honored. There's a PR out to add a "react-native" field: #2208 |
Thanks for the quick answer! However, I can't seem to make it work. For example I have a module in my package.json and hence node_modules which depends on 'request' which depends on 'net'. I would like it to require browser-request instead, but it's still (browserify, on the other hand, does this) |
react native packager do not seems to do it on dependencies? if it is just at top level, it would not have much use as I can always use require("react-native-level-fs") instead of require("fs"). |
It does do it recursively, however, some packages expect to be run after being "browserified", and depend on node modules that browserify will automatically replace / shim with a browser compatible version. At the moment you can use: https://github.com/mvayngrib/rn-nodeify to "hack" the package.json's of your sub-node_modules to add in the necessary replacements |
Closing this out in favor of discussion on the meta-issue at #6253. |
Hi!
browserify can do the following: I specify this in package.json:
and every module which depends on request will use browser-request module instead. Is similar possible with Packager?
(btw I would happily rtfm but couldn't find a documentation for packager)
Thank You!
The text was updated successfully, but these errors were encountered: