This code fails in React Native, but not in Node:
try {
return require('module-does-not-exist');
}catch (e) {
return null;
}
Can anyone tell me why?
Why I care:
I am trying to use the Stanford JavaScript Crypto Library in my React Native app, and it's failing on import because it uses this pattern to optionally use the node crypto
builtin. (source code)
It appears others have hit this snag before: https://github.com/davidbau/seedrandom/pull/44