Incompatible with Bun.js?
Opened this issue · 4 comments
unit-404 commented
I trying to run with Bun.js, but getting this error. Also, I remapped imports. In deno is works (except console.log on some objects). In node.js remapping not supported (root directory).
82 | return this.encode(value, encodeOptions)
83 | }
84 |
85 | this.encode = function(value, encodeOptions) {
86 | if (!target) {
87 | target = new ByteArrayAllocate(8192)
^
TypeError: function is not a constructor (evaluating 'new ByteArrayAllocate(8192)')
at /***/node_modules/cbor-x/encode.js:87:13
kriszyp commented
What version of Bun.js are you using? I believe this error was fixed in newer versions of Bun.
unit-404 commented
Meanwhile I found two strange or fundamental issues.
- "new" operator on "allocate" function is invalid.
- Existence of "Buffer" doesn't guarantee "allocate" exist
And its as minimum.
Here is potential fix for bun.js
9e36800
kriszyp commented
It is not too hard to fix, I've already done it in the msgpackr sibling package, but if it is already fixed, why not just use Bun.js with the fix?
jimmywarting commented
still think that we should totally remove all node:Buffer and only stick to using Uint8Array