Closed yairvillarpt closed 3 years ago
First off, you can pass a Uint8Array in directly now, instead of converting to hex first. Next, what browser and version? I thought everything vaguely modern had TextDecoder now. Maybe it needs a window.
the problem is in the first line the require, im using react native, nodejs 12.18.3
Ok, I'll look into this later; I did test cbor-web with 12, but I'm not sure of the sub-version. Likely not l will need to bring back the fallback to util.TextDecoder. It may take a few days due to some other things going on, but I'll prioritize getting you a fix.
Can you try with node 14 once, in the meantime? That's not a fix, just a datapoint for me.
Yeap, no prob, im gonna try, ill let you know if it works, thanks
I'm going to leave this open until you verify it fixes the problem in your environment. I don't think it should have been possible for this to have failed like this in node 12, but it made it fail in node 10, then took an aggressive approach to prevent the problem in the future.
Please try with v7.0.3 which i just published.
I'm going to assume this worked for you @yairvillarpt. If not, please re-open this issue.
Hi im having this problem where im calling
cbor-web
from react and when i run jest it gives me this errorTypeError: TextDecoder is not a constructor
im importing it this wayconst cbor = require('cbor-web');
and the weird part is that when i doimport cbor from 'cbor-web'
cbor will not get loaded and theconst cbor
is undefined.does anyone got any clues??
here is my code: