greymass / ual-anchor

Identity and session through ESR using EOSIO/universal-authenticator-library
MIT License
23 stars 16 forks source link

Module not found: Error: Can't resolve 'crypto' in 'node_modules/asmcrypto.js' #20

Open str opened 3 years ago

str commented 3 years ago

When pulling ual-anchor via webpack +v5, the following error is shown:

ERROR in ./node_modules/asmcrypto.js/asmcrypto.all.es8.js 4107:27-44
Module not found: Error: Can't resolve 'crypto' in '[...]node_modules/asmcrypto.js'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

The anchor libraries use AES_CBC from asmcrypto.js which imports nodejs "crypto", but its not necessary. The AES_CBC code doesnt actually use any of that crypto

sbrendtro commented 2 years ago

Having the same issue with webpack +v5 (newer create-react-app). Is there a workaround to this?

aaroncox commented 2 years ago

Within your package.json, I believe you can get webpack working by telling it how to resolve that dependency.

resolve: { fallback: { crypto: false} },  

In Webpack5 they changed some of the default dependencies which seems to have created this issue.

vkhv commented 2 years ago

same problem(

vkhv commented 2 years ago

fix https://github.com/greymass/anchor-link/issues/35 https://github.com/greymass/ual-anchor/pull/38

vkhv commented 2 years ago

@aaroncox any feedback please

aaroncox commented 2 years ago

Just published 1.1.6 to npm that includes the fix from https://github.com/greymass/anchor-link/issues/35

Give that a try and see if it resolves the issue!

vkhv commented 2 years ago

work fine. thx