lukeed / fetch-event-stream

A tiny (736b) utility for Server Sent Event (SSE) streaming via `fetch` and Web Streams API
MIT License
376 stars 2 forks source link

Error when running on bun #5

Closed sparty02 closed 6 months ago

sparty02 commented 6 months ago

Bun (as of 1.1.6) doesn't implement TextDecoderStream, so it throws with Can't find variable: TextDecoderStream

lukeed commented 6 months ago

Not sure how you’re installing. This package injects a polyfill before npm publish. Automated via dnt

lukeed commented 6 months ago

Oh sorry, thought you were talking about TextLineStream

You can find a global polyfill for TextDecoderStream, but there's nothing I can/will do for bun here since that's just a core Web API that they need to implemented. But instead theyre too busy modifying existing standard APIs instead of adding support for existing ones.

Milkshiift commented 3 months ago

I am probably missing something, but why can't a polyfill be used? This one for example https://github.com/oven-sh/bun/issues/5648#issuecomment-2143413569 Doesn't look like a native implementation is coming soon

lukeed commented 3 months ago

One can, but you have to bring/supply it. The one you linked may work.

globalThis.TextDecoderStream ||= TextDecoderStream;