Doesn't work with react-native
bkniffler opened this issue · 5 comments
Hey, this library works nice in node/browser. But unfortunately not with react-native, since there is no global Buffer
element. Replacing that part with require('buffer').Buffer
works.
So maybe this could be changed to something along: let buffer = typeof Buffer !== 'undefined' ? Buffer : require('buffer').Buffer;
?
We can easily do a require('buffer').Buffer
instead. Would you like to send a PR?
I'm getting an error:
hyperid.js:64 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'from')
at baseId (hyperid.js:64:25)
which might be related.
It's a SvelteKit project (Vite).
Leads to the following error now, when building with webpack:
ERROR in ./node_modules/hyperid/hyperid.js 5:13-37
Module not found: Error: Can't resolve 'buffer' in '/home/druf/Schreibtisch/projects/bitexpert/3-CMS/assets/headless/node_modules/hyperid'
Would you like to send a Pull Request to address this issue? Remember to add unit tests.