walletconnect-monorepo icon indicating copy to clipboard operation
walletconnect-monorepo copied to clipboard

WalletConnect v2 does not work with SvelteKit+Vite (rollup)

Open tfalencar opened this issue 3 years ago • 3 comments

When trying to follow the tutorial on:

https://docs.walletconnect.com/2.0/quick-start/dapps/ethereum-provider

The following error appears:

500 Importing binding name 'PairingTypes' is not found. moduleDeclarationInstantiation@[native code] link@[native code] linkAndEvaluateModule@[native code] @[native code] asyncFunctionResume@[native code] @[native code] promiseReactionJobWithoutPromise@[native code] promiseReactionJob@[native code]

Steps to reproduce:

  • Setup a new SvelteKit project
  • Follow documentation from WalletConnect

tfalencar avatar Mar 18 '22 14:03 tfalencar

+1

zhanzekun avatar Mar 19 '22 08:03 zhanzekun

I'm having the same problem. Are there any good workarounds?

yekta avatar Mar 21 '22 18:03 yekta

@tfalencar as a temporary workaround, I was able to get it all running in sveltekit using these imports. Vite borks unless you import the umd files directly for some reason and the types should work if you add import type to the beginning to denote that it's a typescript import

import WalletConnectProvider from '@walletconnect/ethereum-provider/dist/umd/index.min'
import WalletConnectClient, { CLIENT_EVENTS } from '@walletconnect/client/dist/umd/index.min'
import type { PairingTypes, SessionTypes } from '@walletconnect/types'

avivash avatar May 24 '22 23:05 avivash

@tfalencar @yekta is this still an issue?

finessevanes avatar Jan 17 '23 23:01 finessevanes

@finessevanes I think its better to ask the walletconnect's development team if they solved the root cause of this issue.

tfalencar avatar Jan 19 '23 08:01 tfalencar

I’m closing this issue because it has been inactive for a few months.

Please reopen if you still encounter this issue with the latest version :)

glitch-txs avatar Aug 06 '23 08:08 glitch-txs

SvelteKit + Web3Modal example: https://github.com/WalletConnect/web-examples/pull/346

glitch-txs avatar Dec 14 '23 01:12 glitch-txs