greymass / anchor-link

Persistent, fast and secure signature provider for EOSIO chains built on top of EOSIO Signing Requests (EEP-7)
Other
53 stars 22 forks source link

React JS node modules error while using anchor link #35

Closed gajrajs99 closed 2 years ago

gajrajs99 commented 2 years ago

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 2 years ago

bump

chemisax commented 2 years ago

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.

jnordberg commented 2 years ago

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.

jnordberg commented 2 years ago

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

chemisax commented 2 years ago

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