When I was developing on pc, I didn’t know because there was no error. My team members have been struggling for 2 weeks. Please help.
I’m using @web3auth/modal using React Vite,
If you only enter the mobile web browser, the openlogin adapter does not work.
I also checked the version because I was afraid that it was not supported by the mobile browser (Safari, Chrome), but they were all the latest versions.
When I accessed the demo page (https://demo.web3auth.io/) provided by web3auth on my mobile
It worked well.
So I thought there was a problem with our code, so I looked for the error for a long time.
while GitHub - Web3Auth/web3auth-pnp-examples
I downloaded that code here and tried running both react-no-modal and react-modal, but I got the same error.
The error is
Unhandled Promise Rejection: TypeError: null is not an object (evaluating ‘import_crypto.default.createHash’
Ida.
Thank you so much!
I ran the demo code as ‘npm run dev – – host’ and tested both pc and mobile, and still mobile gets the same error… It’s really hopeless…
We really want to use the web3auth service in our project.
Module “crypto” has been externalized for browser compatibility. Cannot access “crypto.createHash” in client code. See Troubleshooting | Vite for more details.
When you use a Node.js module in the browser, Vite will output the following warning.
Module "fs" has been externalized for browser compatibility. Cannot access "fs.readFile" in client code.
This is because Vite does not automatically polyfill Node.js modules.
We recommend avoiding Node.js modules for browser code to reduce the bundle size, although you can add polyfills manually. If the module is imported from a third-party library (that's meant to be used in the browser), it's advised to report the issue to the respective library.