You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
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
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:
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: