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

Error: Cannot find module 'crypto' #189

Open kevincompton opened 2 weeks ago

kevincompton commented 2 weeks ago

This package is giving my app an error on run, it seems to have a deprecated plugin

  1. Install the plugin
  2. require it
  3. run the environment
  4. inspect the trace stack for this error
justynspooner commented 1 week ago

I think I'm having a similar issue to you. Please see if this is similar to what you're seeing. I've added links to a repo and additional context to help with working out a proper fix.

kevincompton commented 1 week ago

I think I'm having a similar issue to you. Please see if this is similar to what you're seeing. I've added links to a repo and additional context to help with working out a proper fix.

I'm afraid this link is bad

kevincompton commented 1 week ago

So I've looked into this further and it's for sure whats failing my lint. It works fine without it locally but any attempt at a polyfill so far has failed to get rid of the npm error (possibly because it's coming from a sub package). By all accounts you guys shouldn't be using this package for client side applications. In the meantime I'm just going to have to circle back to deploying my app on netlify.

justynspooner commented 1 week ago

Apologies, here is the link to the ticket https://github.com/hashgraph/hedera-wallet-connect/issues/190

If you're running an app that uses server side rendering then you can dynamically import the library which should solve the issue you're seeing. Here's an example in a NextJS app:

https://github.com/justynspooner/hedera-wallet-connect-test/blob/c17d3e5aacfc79d1a73c76f9c6b3b127791f30ee/components/HederaWalletConnect.tsx