Nuxt 3 -> "Global is not defined" when instantiating web3auth

Hello!
Testing a boilerplate Nuxt 3 + Vite site with web3auth. Installed the packages and initiated the modal:

    const web3auth = new Web3Auth({
    clientId: "<my client ID>"
    chainConfig: {
        chainNamespace: "eip155",
        chainId: "0x5", // Please use 0x5 for Goerli Testnet
    },
    });
    await web3auth.initModal();

When loading the page, it gives this error:

500 global is not defined 
at node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js (http://localhost:3000/_nuxt/node_modules/.vite/deps/chunk-PIIR32NY.js?v=d244de6a:6677:18)
at __require2 (http://localhost:3000/_nuxt/node_modules/.vite/deps/chunk-JZQ37OGZ.js?v=d244de6a:18:50)
at http://localhost:3000/_nuxt/node_modules/.vite/deps/chunk-PIIR32NY.js?v=d244de6a:15841:34
  • Installed polyfills, added the config but still the same issue
  • I also disabled ssr in nuxt
  • Followed instructions here as well Error on Nuxt 3 stable

What else could I try?

Thanks!

  • SDK Version: web3authmodal 5.0.1
  • Platform: Nuxt v3 + Vite
  • Browser Console Screenshots:
  • Related to Custom Authentication? Please provide the following info too: (Optional)
    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken(JWT)

Please provide the Web3Auth initialization and login code snippet below:
(see above)