You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I just saw this issue, and I don't see the screen shot, but it sounds similar to a problem I am having. I just installed QRCode on my server to test it out and right out of the box, when running a Jest Test, it came back with the following error:
ReferenceError: TextEncoder is not defined
at new ByteData (./node_modules/qrcode/lib/core/byte-data.js:6:21)
at buildSingleSegment (./node_modules/qrcode/lib/core/segments.js:262:14)
at ./node_modules/qrcode/lib/core/segments.js:286:16
at Array.reduce ()
When I looked at the source file byte-data.js, I noticed that line 6 or 7 references TextEncoder() as a global constant.
I added on line 2: const util = require('util')
and changed line (6 or 7) to this.data = new util.TextEncoder().encode(data)
And the code stopped crashing. I know my hot fix is going to lead to deployment issues, and I am not sure much more of the working of this package, but I would be willing to help work on this issue, just might need a little guidance. I would rather use the dependency directly than making a personal fork, fixing, and throwing it in my codebase somewhere.
The text was updated successfully, but these errors were encountered: