I\'m trying to use node modules in my react-native app, and I\'m taking the ReactNativify approach here.
I\'m all set up now, and I got the crypto package to load i
first install the following
yarn add buffer process babel-plugin-react-native-nodeify-hack
Then add to your babel settings .babelrc
{
"presets": ["react-native"],
"plugins": ["babel-plugin-react-native-nodeify-hack"]
}
Import the buffer and process modules manually. In your index.ios.js and index.android.js, add this to the first line:
import process from 'process';
import buffer from 'buffer';
global.Buffer = buffer.Buffer
try to stop the running React Native Packager, and run:
rm -rf $TMPDIR/react-*
and start it again
You are good to go!