Open IanPhilips opened 4 years ago
Sorry, I don't think we have anyone with any experience with React Native. My guess is that it's a conflict between being treated as a browser vs Node and there's a mixup in that process somewhere.
I'd say your first problem is arising out of https://github.com/ipld/js-get-codec which has different bundling rules for the browser vs Node.js. You may need to manually insert the codec you want rather than letting it choose for you.
The second, probably https://github.com/multiformats/js-multihashing-async, which also has browser-specific rules that may need to be overiden (see package.json#browser which diverts sha to browser code that uses crypto.subtle which isn't available in Node.js).
Gotcha, I'll try this stuff out after ETHDenver, thanks!
Hi,
Any idea how to make this work with react native? I tried
node-libs-react-native
andrn-nodeify
to supply the necessary node libraries but I can't source Block viaimport {Block} from '@ipld/block'
and then calling it like solet block = Block.encoder({hello: 'world'}, 'dag-cbor');
to work:TypeError: undefined is not an object (evaluating '_block.Block.encoder')
Though if I implement it like so I get a dif undefined error:
gives:
TypeError: undefined is not an object (evaluating 'crypto.subtle.digest')