Closed yashovardhan closed 8 months ago
Hey, have you tried building this? On next.js app there's a build error.
ReferenceError: window is not defined
at get isDark [as isDark] (/Users/maurechi/repo/node_modules/@web3auth/ui/dist/ui.cjs.js:5139:78)
at LoginModal.initModal (/Users/maurechi/repo/node_modules/@web3auth/ui/dist/ui.cjs.js:4887:22)
at Web3Auth.initModal (/Users/maurechi/repo/node_modules/@web3auth/modal/dist/modal.cjs.js:325:27)
at Object.getProvider (/Users/maurechi/repo/.next/server/chunks/913.js:1:7124)
at reconnect (file:///Users/maurechi/repo/node_modules/@wagmi/core/dist/esm/actions/reconnect.js:50:43)
Node.js v18.17.1
Generating static pages (0/15) [ ==]/Users/maurechi/repo/node_modules/@web3auth/ui/dist/ui.cjs.js:5139
return this.uiConfig.mode === "dark" || this.uiConfig.mode === "auto" && window.matchMedia("(prefers-color-scheme: dark)").matches;
Shows when trying to build in vercel as well
using latests versions of web3auth
"@web3auth/modal": "^7.3.2",
"@web3auth/openlogin-adapter": "^7.3.2",
even installing to make sure versions are ok
"@web3auth/base": "^7.3.2",
"@web3auth/ui": "^7.3.2",
Needs a ‘’‘ts typeof globalThis.window === “undefined” ‘’’ top level check
can just be a const
Hey @Maurechi
It might be because of version mismatch of the connector. I've updated everything to Web3Auth v8 and also added the next example testing your usecase. The build and the dev mode both work fine.
Tested in both examples, all scenarios are working correctly. Deleted extra examples. Will test further with alpha release on general examples on examples repository.