loopring_sdk icon indicating copy to clipboard operation
loopring_sdk copied to clipboard

Using the SDK in browser environment not working

Open daniel-soli opened this issue 2 years ago • 1 comments

I'm running a browser environment Vue application. When using the SDK it does not work because of "type": "module" in the package.json file. When running with this I get a "reuire not defined". When removing that line manually in the sdk, everything works locally, but this does not work when deploying ofc.

Are there any reason for type module, since AFAIK it just got added in 3.3.8 ->? Any tips on how to get it to work in browser environment?

I also noticed that permutation.ts uses require for blake2b, is it possible to set this up to be browserfriendly?

daniel-soli avatar Jul 07 '23 16:07 daniel-soli

I had to fork this repo to do the changes and publish my own package. The two "issues" mentioned above seemed to get it working.

  • import { default as blake2b} from 'blake2b'; in permutation.ts
  • package.json - remove "type": "module"

daniel-soli avatar Jul 10 '23 06:07 daniel-soli