hildjj / node-cbor

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

BUG: Class extends value undefined is not a constructor or null #193

Open nayounsang opened 3 weeks ago

nayounsang commented 3 weeks ago

Hi. I found error in this package in browser runtime. This is callstack.

Uncaught TypeError: Class extends value undefined is not a constructor or null
    at node_modules/nofilter/lib/index.js (cbor.js?v=1accc57c:439:18)
    at __require (chunk-BUSYA2B4.js?v=1accc57c:3:50)
    at node_modules/cbor/lib/utils.js (cbor.js?v=1accc57c:1018:20)
    at __require (chunk-BUSYA2B4.js?v=1accc57c:3:50)
    at node_modules/cbor/lib/commented.js (cbor.js?v=1accc57c:2260:17)
    at __require (chunk-BUSYA2B4.js?v=1accc57c:3:50)
    at node_modules/cbor/lib/cbor.js (cbor.js?v=1accc57c:4101:21)
    at __require (chunk-BUSYA2B4.js?v=1accc57c:3:50)
    at cbor.js?v=1accc57c:4201:16

Env

browser (chrome)

packages

"vite": "^5.4.1", "react": "^18.3.1", "react-dom": "^18.3.1", "cbor": "^9.0.2",

packageManageer

"packageManager": "yarn@1.22.22"

Description

I test and install another encoding & decoding packages, such as msgpack, bson, ... Could this be cause this error?

hildjj commented 3 weeks ago

If you're not using cbor-web and instead trying to do web packaging yourself, you'll need to look in the webpack-demo and parcel-demo directories to get some idea of how this might work.

However, I'd strongly recommend using the cbor2 library, which is web-native by default.