Using Core Node JS Modules in #react Native Apps
▻https://hackernoon.com/using-core-node-js-modules-in-react-native-apps-64acd4d07140?source=rss-
Here’s a problem you might run into while using React Native: Let’s say you want to use the crypto module to create some hashes. It might seem natural to do something like this:▻https://medium.com/media/68d54b356fea87b72ea19a1aa7b00233/hrefBut this doesn’t work, because crypto is a core Node JS module, which means it’s probably C++ code bundled with the Node JS binary, not #javascript. The React Native packager can’t package it[1] along with your app’s Javascript bundle, so you get a runtime error: Unable to resolve module ’crypto’.This makes core modules like crypto, stream etc. and the thousands of npm modules that depend on them unusable from React Native. Fortunately, there’s a solution to this problem, but it takes some work.SolutionIf you’re familiar the module bundler Browserify, (...)