Uniswap / web3-react

A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
https://web3-react-mu.vercel.app/
GNU General Public License v3.0
5.56k stars 1.52k forks source link

WalletConnectV2 TypeError: Og2.default.init is not a function #840 #861

Open ersanyakit opened 1 year ago

ersanyakit commented 1 year ago

Im using VITEJS + React TS

Seeing an error when trying to use wallet connect in our dapp when deployed on IPFS. activate.ts:57 TypeError: Og2.default.init is not a function at hr2.createClient (index.cjs.js:27:29719) at hr2.initialize (index.cjs.js:27:29572) at hr2.init (index.cjs.js:27:26718) at I2.initialize (index.cjs.js:1:6874) at I2.init (index.cjs.js:1:2663) at WalletConnectV2.<anonymous> (index.js:87:79) at Generator.next (<anonymous>) at fulfilled (tslib.js:112:62)

Ekran Resmi 2023-07-21 17 13 36

Test URL : https://imon.ai

Nookee411 commented 1 year ago

Im using VITEJS + React TS

Seeing an error when trying to use wallet connect in our dapp when deployed on IPFS. activate.ts:57 TypeError: Og2.default.init is not a function at hr2.createClient (index.cjs.js:27:29719) at hr2.initialize (index.cjs.js:27:29572) at hr2.init (index.cjs.js:27:26718) at I2.initialize (index.cjs.js:1:6874) at I2.init (index.cjs.js:1:2663) at WalletConnectV2.<anonymous> (index.js:87:79) at Generator.next (<anonymous>) at fulfilled (tslib.js:112:62)

Ekran Resmi 2023-07-21 17 13 36

Test URL : https://imon.ai

Have you managed to resolve this issue?

ersanyakit commented 1 year ago

yes, its fixed. just update your vite.config.ts

Ekran Resmi 2023-07-29 08 59 14

alias: { '@walletconnect/ethereum-provider': '../../../@walletconnect/ethereum-provider/dist/index.es.js', '@walletconnect/utils': '../../../@walletconnect/utils/dist/index.umd.js', '@': path.resolve(__dirname, './src'), }

chris13524 commented 1 year ago

I think this issue is related to #840 and a potential fix in web3-react without updating packaging is here: https://github.com/Uniswap/web3-react/issues/840#issuecomment-1613619864

christiecc8 commented 1 year ago

@ersanyakit thank you for the workaround, it worked for me. bumping this issue