Closed antonioandrade closed 7 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.
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.
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.
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:
diff --git a/node_modules/effect-http/dist/esm/index.js b/node_modules/effect-http/dist/esm/index.js
index 3775872..e3d0805 100644
--- a/node_modules/effect-http/dist/esm/index.js
+++ b/node_modules/effect-http/dist/esm/index.js
@@ -33,13 +33,13 @@ export * as ClientError from "./ClientError.js";
*
* @since 1.0.0
*/
-export * as ExampleServer from "./ExampleServer.js";
+// export * as ExampleServer from "./ExampleServer.js";
/**
* Mechanism for extendning behaviour of all handlers on the server.
*
* @since 1.0.0
*/
-export * as Middlewares from "./Middlewares.js";
+// export * as Middlewares from "./Middlewares.js";
/**
* `Client` implementation derivation for testing purposes.
*
@@ -51,7 +51,7 @@ export * as MockClient from "./MockClient.js";
*
* @since 1.0.0
*/
-export * as NodeServer from "./NodeServer.js";
+// export * as NodeServer from "./NodeServer.js";
/**
* Derivation of `OpenApi` schema from an instance of `Api`.
*
@@ -76,7 +76,7 @@ export * as Route from "./Route.js";
*
* @since 1.0.0
*/
-export * as RouterBuilder from "./RouterBuilder.js";
+// export * as RouterBuilder from "./RouterBuilder.js";
/**
* Server errors.
*
@@ -88,11 +88,11 @@ export * as ServerError from "./ServerError.js";
*
* @since 1.0.0
*/
-export * as SwaggerRouter from "./SwaggerRouter.js";
+// export * as SwaggerRouter from "./SwaggerRouter.js";
/**
* Testing of the `Server` implementation.
*
* @since 1.0.0
*/
-export * as Testing from "./Testing.js";
+// export * as Testing from "./Testing.js";
//# sourceMappingURL=index.js.map
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.
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.
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 polyfillstream
on a vite build.The documentation is pretty clear that
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.