hashgraph / hedera-wallet-connect

This package is a messaging relay between decentralized applications and wallets in Hedera network based on Wallet Connect relays.
Apache License 2.0
7 stars 15 forks source link

SyntaxError: Cannot declare a let variable twice: 'n'. #194

Open justynspooner opened 1 week ago

justynspooner commented 1 week ago

Describe the bug

The package appears to be clashing with the global namespace…

To Reproduce

Checkout this minimal repository which is a vanilla NextJS app with the HWC package imported dynamically in a client component:

https://github.com/justynspooner/hedera-wallet-connect-test/tree/main

npm install
npm run build
npm run start

Check the console logs in the browser:

SyntaxError: Cannot declare a let variable twice: 'n'.

Expected behavior

Should be able to build a production release and have the resulting app not throw the error.

Additional context

I checked out the @hashgraph/hedera-wallet-connect repo and turned off the esbuild minification feature. I then built the package and imported that dependency directly into the project. This worked fine without any SyntaxErrors. As soon as I turn on minification, the problem occurs again.

justynspooner commented 4 days ago

Does anyone else have the library working with the latest NextJS 14?

Would love to see how to solve this as right now it doesn't seem to work out of the box.