-
Notifications
You must be signed in to change notification settings - Fork 24.1k
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
Compatibility: node packages depending on V8 can't function in react-native iOS #5881
Comments
Hey ambarc, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
I would't say this is possible, just like it's not possible to use node modules in Chrome or Firefox. You can check this out, but I don't think it's going to be production ready: https://github.com/mvayngrib/rn-nodeify |
For emphasis: just as Node and the browser are different environments that happen to use the same language, React Native is a third JS environment that's not a browser and isn't Node. Packages need to be written to either be universal or specifically written for React Native. There's the "react-native" key in package.json for aliasing modules but fundamentally packages made for Node aren't necessarily going to work with RN. |
In practice, I suggest bugging Twilio to make their stuff work with React Native. I'm closing this issue because I believe it has only the potential for philosophical angst at this point. Good luck! |
There's the option to run V8 on android with node built-in. Haven't tried yet, but I will. |
I'm building a react-native app to go across Android and iOS. I'm noticing some dependencies in libraries I'm using depend on having a V8 (node) runtime. This breaks the JavaScriptCore JS runtime on iOS, with RN error-ing with something like:
Requiring unknown module _moduleA_. If you are sure the module is there try restarting the packager.
What I'm noticing is that v8 requiring moduleA doesn't get copied over in the react bundle that gets placed on the phone. I found this by logging the modules present in
node_modules/react-native/packager/react-packager/src/Resolver/polyfills/require.js
Since I don't own the libraries that I'm trying to use I can't modify the dependency.
In my case I'm trying to use the twilio module which uses Node's crypto module.
I'm guessing I won't face this issue when I build RN on Android.
What are the options like?
The text was updated successfully, but these errors were encountered: