MeshJS / mesh

TypeScript open-source library to advance Web3 development on Cardano
https://meshjs.dev
Apache License 2.0
221 stars 65 forks source link

Class extends value undefined is not a constructor or null (@stricahq/cbors/dist/Decoder.js) #267

Open sennykalidien opened 3 months ago

sennykalidien commented 3 months ago

When using React w/ Webpack with the latest versions of meshsdk: "@meshsdk/core": "1.6.8", "@meshsdk/react": "1.6.8",

I get the following TypeError: Class extends value undefined is not a constructor or null

Full error message: TypeError: Class extends value undefined is not a constructor or null at ../../node_modules/@stricahq/cbors/dist/Decoder.js (http://localhost:6006/vendors-node_modules_meshsdk_core_dist_core_-0c8d45.iframe.bundle.js:144431:30) at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33) at fn (http://localhost:6006/runtime~main.iframe.bundle.js:434:21) at ../../node_modules/@stricahq/cbors/dist/index.js (http://localhost:6006/vendors-node_modules_meshsdk_core_dist_core_-0c8d45.iframe.bundle.js:145094:17) at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33) at fn (http://localhost:6006/runtime~main.iframe.bundle.js:434:21) at ../../node_modules/@meshsdk/core-cst/dist/index.js (http://localhost:6006/vendors-node_modules_meshsdk_core_dist_core_-0c8d45.iframe.bundle.js:40382:74) at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33) at fn (http://localhost:6006/runtime~main.iframe.bundle.js:434:21) at http://localhost:6006/vendors-node_modules_node_modules_meshsdk_core_dist_core_-0c8d45.iframe.bundle.js:76461:75

Last known versions when I didn't got this error: "@meshsdk/core": "1.5.25", "@meshsdk/react": "1.1.12",

HinsonSIDAN commented 3 months ago

Any repo can be shared / specific way to reproduce?

jinglescode commented 3 months ago

@sennykalidien install version 1.6.9, also to ensure that dependencies packages are also up to date, try npm install @meshsdk/core-cst@1.6.9 too

sennykalidien commented 3 months ago

@HinsonSIDAN I'll create a repo that will reproduce this error later today. @jinglescode I'll try this and will report back if it worked.

i-jump commented 3 months ago

I also encountered this problem and don't know how to solve it

sennykalidien commented 3 months ago

@HinsonSIDAN I've created a small repo with React, Webpack 5, Babel and Storybook.

in ./storybook/main.js you can find the additional Webpack config needed to work with MeshJS.

@jinglescode I've made sure all dependencies are up to date and installed meshsdk/core-cst@1.6.9. It did not help unfortunately.

Link to repo to reproduce issue: https://github.com/sennykalidien/meshjs-react-example

Packages:

"@meshsdk/core": "^1.6.9",
"@meshsdk/core-cst": "^1.6.9",
"@meshsdk/react": "^1.6.9",
"buffer": "^6.0.3",
"stream": "^0.0.3"

Hope this helps.

HinsonSIDAN commented 3 months ago

Just done basic investigation, it should be something around package compilation in the strica dependency, so it might not be a quick fix. we will continue investigating workaround and see if there is a more universally clean fix for this.

Tarbez commented 1 week ago

i'm having the same issue... is there a fix yet?

jinglescode commented 3 days ago

add another report:

It's a dependency pulled in somewhere either directly by Mesh or transitively (I would guess directly). @strahq/cbors/Decoder.js:55 defines a type which inherits from node stream, which is undefined, which throws an error.