Specifying a browser override of false for the node crypto module prevents bundlers from attempting to shim the crypto module just because a require('crypto') call exists. (It is being used only in the random.js file, in a try/catch so that the crypto module gets used if available, but SJCL will still work without it.)
This solves three problems:
Bundlers that do not automatically shim the crypto module will not produce missing dependency errors now.
Bundlers that do automatically shim the crypto module will no longer do so, providing smaller final builds.
Since SJCL is actually used in order to create shims of the crypto module, this eliminates some odd circular dependency issues. (In particular, the react-native-crypto shim ends up invoking SJCL through the react-native-randombytes module.)
Specifying a browser override of
false
for the nodecrypto
module prevents bundlers from attempting to shim thecrypto
module just because arequire('crypto')
call exists. (It is being used only in therandom.js
file, in a try/catch so that thecrypto
module gets used if available, but SJCL will still work without it.)This solves three problems:
crypto
module will not produce missing dependency errors now.crypto
module will no longer do so, providing smaller final builds.crypto
module, this eliminates some odd circular dependency issues. (In particular, thereact-native-crypto
shim ends up invoking SJCL through thereact-native-randombytes
module.)This will fix issues #362 and #371.