[Archive] Unable to resolve module crypto

:classical_building: Archived Content from Web3Auth Community

This topic was originally posted by yammonabd on 7/11/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.


Full Error:
Error: undefined Unable to resolve module crypto from /node_modules/@toruslabs/eccrypto/dist/eccrypto.cjs.js: crypto could not be found within the project or in these directories:
node_modules
76 | });
77 |

78 | ;// CONCATENATED MODULE: external “crypto”
| ^
79 | const external_crypto_namespaceObject = require(“crypto”);
80 | var external_crypto_default = /#PURE/webpack_require.n(external_crypto_namespaceObject);
81 | ;// CONCATENATED MODULE: external “elliptic”]


Info

Please provide the Web3Auth initialization and login code snippet below:
const web3auth = new Web3Auth(WebBrowser, {
clientId,
network: OPENLOGIN_NETWORK.TESTNET, // or other networks
});

@yammonabd Thanks for your post.

Your issue has been forwarded to our team and we will get back with further updates once more information becomes available.

Facing same issue with using expo and @web3auth/react-native-sdk 4.0.0.
Is there any quick workaround so I wouldn’t be stuck at this point?

Please use the following config as present in our demo:
Metro: https://github.com/Web3Auth/web3auth-react-native-sdk/blob/master/demo/rn-expo-example/metro.config.js
Bare: https://github.com/Web3Auth/web3auth-react-native-sdk/blob/master/demo/rn-bare-example/metro.config.js