pamelafox / ndjson-readablestream

A small JS package for reading a ReadableStream of NDJSON
MIT License
9 stars 4 forks source link

ReferenceError: module is not defined in ES module scope #5

Closed grubino closed 8 months ago

grubino commented 10 months ago

Hello! I'm working on a project that depends on ndjson-readablestream and I'm getting this error which apparently is caused by the name of the main package:

dist/ndjson-readablestream.cjs.js

Which is odd, because it only shows up when I run my tests (vitest). If I rename ndjson-readablestream.cjs.js => nsjson-readablestream.cjs and update the reference in package.json, then the error goes away. I'm not really an expert on ES <=> CJS interoperability, but I really hope there is a better solution for this.

pamelafox commented 9 months ago

Huh, I am also not an expert in CJS, but I'll ask around, thanks for filing!

pamelafox commented 9 months ago

@grubino I think I've resolved this, can you try the alpha?

npm install ndjson-readablestream@1.1.0-alpha.0

psd-coder commented 8 months ago

I can confirm that this alpha version works for me

pamelafox commented 8 months ago

Thanks! I've released as non-alpha. Closing this now as fixed by https://github.com/pamelafox/ndjson-readablestream/pull/7