hildjj / node-cbor

Encode and decode CBOR documents, with both easy mode, streaming mode, and SAX-style evented mode.
MIT License
356 stars 73 forks source link

cbor-web import as shown does not work #192

Open TCNOco opened 1 month ago

TCNOco commented 1 month ago

Maybe I'm just lost, but the example of import cbor from 'cbor-web' gives me errors when I call functions. cbor is undefined. However, checking the cbor-web source, I see export * from 'cbor' is used -- so I tried import * as cbor from 'cbor-web' and it works as expected.

Maybe I'm just doing something incorrectly, but in my Next.js 14 project I can only get the normal require, or the modified import to work.

hildjj commented 1 month ago

If you haven't gone too far, I'd suggest you use cbor2 instead. It is web-safe ESM out of the box.