sukovanej / effect-http

Declarative HTTP API library for effect-ts
https://sukovanej.github.io/effect-http
MIT License
251 stars 20 forks source link

browser-only / client-derivation? #365

Closed antonioandrade closed 7 months ago

antonioandrade commented 10 months ago

Hey there. I love the proposal here, thanks and kudos.

Are there any plans to have a proper browser-only/client-derivation version of this? It seems to me that the lib depends on @effect/platform (and @effect/platform-node) which forces us to go through hoops and loops to polyfill stream on a vite build.

The documentation is pretty clear that

[...] effect-http is intended to be primarly used on the server-side

but here I am, wishing for a way to use this as a browser http client.

I'll take no for an answer alright; mostly wondering if you have any comments on how hard it would be to extract (or better, isolate) that portion of the functionality.

Cheers.

sukovanej commented 10 months ago

Hey, I'm actually using this lib on frontend myself (react + vite). I've faced some problems in the past and resolved them by importing @effect/platform-node dynamically in the node-specific code only. Could you please share a repro? I'd take a look on that.

I'm aware the current setup is somewhat not ideal because of the optional dependency onto @effect/platform-node. I'm thinking about doing a similar separate packages setup as the effect platform monorepo does.

antonioandrade commented 10 months ago

Thanks @sukovanej great to read that we're aligned in perception! I'll work on a repro of my scenario that I can share, hopefully close to this weekend.

sukovanej commented 10 months ago

Perfect 👍 also please try with the latest effect-http version because @fubhy did a rewrite of the build so that it uses the same setup as other effect packages. It might affect this as well.

izakfilmalter commented 9 months ago

Running into this on next.js. Thankfully I am just using this lib to talk to external apis, I patched out the following modules from effect-http:

sukovanej commented 8 months ago

Hey, I just did a first monorepo release with effect-http + effect-http-node separated packages. I'm gonna test it during the weekend on our company internal codebase. It should resolve these issues.

sukovanej commented 7 months ago

Hey, I haven't encoutered the problem after separating the project into two packages. I'm gonna close this one. Feel free to reach me on the discord or open an issue there if anything else occurs.