greymass/anchor-link

React JS node modules error while using anchor link

gajrajs99 opened this issue · 5 comments

Hi,
I have developing the anchor wallet integration for the react js application, for that I have install the anchor-link and anchor-link-browser-transport latest package. When we run it it shows below error:

ERROR in ./node_modules/asmcrypto.js/asmcrypto.all.es8.js 3901:23-40
Module not found: Error: Can't resolve 'crypto' in 'D:\My-Project\node_modules\asmcrypto.js'**

To solve this error we have to add the fallback in the node module file. Then it successful run on the local server, but when we deploy it on the live server, the server does not take node modules.
So please give some suggestions on this issue.

vkhv commented

bump

Same problem here.
Haven’t found a solution when using create-react-app yet. Create-react-app doesn’t allow to modify the webpack configuration file.

Currently there is no way around this issue without modifying how your bundler behaves due to how asmcrypto does feature detection. You can try to set {"browser": {"crypto": false}} in your package.json, that helps in some configurations in my experience.

Dropped the asmcrypto.js dependency, try with anchor-link version 3.4.1 and let me know if that resolves your issue

@jnordberg version 3.4.1 worked! Thank you for your support.