-
Notifications
You must be signed in to change notification settings - Fork 101
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
RePack with rn_nodeify #591
Labels
Comments
This is a reproducible repo for the rn_nodeify implementation which includes =>
https://github.com/vlack-coder/nodifypack |
Hi @vlack-coder, I'll take a look at this when I have some spare time, since it's using May I ask what do you need it for? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I've been trying to add rn_nodeify library available in my rePack project but it's not working
What rn_nodeify does:
It provides your react-native project with core nodeJs modules
How it works:
It recurses down node_modules and modifies all the package.json's in node_modules to add/update the browser and react-native entry fields and it does it in the post-install script when yarn is ran
Adding rn_nodeify
After adding rn_nodeify, it adds only the library stated in the postinstall script -
"postinstall": "./node_modules/.bin/rn-nodeify --hack --install crypto,stream,process,events,vm-browserify",
which are the library needed for cryptoJs to work yielding the below
By default, it maps all these modules to the browser and react-native fields, In my case
It also generates and adds shim.js to the root of the project which is in turn imported in the entry point of the project, index.js
Shim.js populates some necessary nodeJs module
Installation Aftermath
After all the above steps, it works perfectly with metro but with repack, fistly I had to edit webpack config because I got an invariant cannot be resolved in all the modules, react native included
After adding this, that error was resolved
Latly, in the shim.js, I cannot log the process library but I can log its typeof which is an object (ehereas in metro I can do both)
Also I removed this -
process.env['NODE_ENV'] = isDev ? 'development' : 'production'
because I was getting lefthand side assignment error probably because process.env['NODE_ENV'] was likely undefined
Everything works fine with metro but not repack, please any suggestion on what I can I do. Thanks
I also tried everything under this issue to no avail - Issue 296
The text was updated successfully, but these errors were encountered: