Skip to content

index.mjs:151 Uncaught (in promise) TypeError: destr__WEBPACK_IMPORTED_MODULE_0__ is not a function #806

Open
@HTR2747

Description

@HTR2747

// Facing this error "Uncaught (in promise) TypeError: destr__WEBPACK_IMPORTED_MODULE_0__ is not a function" on this EthereumProvider.init when I am adding this code in my existing application. If I create a new react template application it works fine!
// See my react hook component code usage

import { EthereumProvider } from '@walletconnect/ethereum-provider'

// 2. Initialize sign client
async function onInitializeProviderClient() {
const client = await EthereumProvider.init({
projectId: 'my-app-id',
showQrModal: true,
qrModalOptions: { themeMode: 'light' },
chains: [1],
methods: ['eth_sendTransaction', 'personal_sign'],
events: ['chainChanged', 'accountsChanged'],
metadata: {
name: 'My App',
description: 'My App Description',
url: 'https://my.app.com',
icons: ['https://my.app.com/logo.png'],
},
})
setProviderClient(client)
}

useEffect(() => {
    onInitializeProviderClient()
}, [])
// Function to handle connection
// 3. Enable / connect with provider, will open web3modal
async function onConnect() {
    if (providerClient) {
        await providerClient.connect()
    } else {
        throw new Error('providerClient is not initialized')
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions