rafaelrcamargo / r19

A dead-simple React 19 "framework" implementation from scratch
https://cmrg.me/blog/rsc-part-1-the-backstory
77 stars 5 forks source link

feat: only one process for the server #4

Open aheissenberger opened 6 months ago

aheissenberger commented 6 months ago

Hi Rafael,

you did an amazing job in getting this working!!

Have a look at my changes to your rss.ts and rsc.ts which allow to only have one running process and bun.serve as the http server: https://github.com/aheissenberger/r19/tree/bon-one-server

The new server is in ssr-bun.ts. Pages can be build with bun run bunbuild and then starte the server with bun start

problems:

next planned steps:

rafaelrcamargo commented 6 months ago

Hmm, that’s really, really interesting. I had not thought about a bun plugin to apply the conditions for the framework itself. This sounds promising; I will look into that over the weekend.

If you want some references to maybe figure out those weird behaviors in the meantime, Kotekan has a similar setup.

aheissenberger commented 6 months ago

It would also help if someone can implement the option to add conditions for resolve in bun: https://github.com/oven-sh/bun/issues/1527

aheissenberger commented 6 months ago

I did look at Kotekan but this implementation is using the multiple process architecture.

My current implementation needs only one process and supports hot reloading in the dev mode bun run start-dev see file ssr-bun-dev.ts. The hot reload library sometime fails to open a socket and currently only supports one build config. I will rewrite this lib to support multiple configs.

rafaelrcamargo commented 6 months ago

I did look at Kotekan but this implementation is using the multiple process architecture.

Yeah, I only mentioned in case you wanted to have a different reference to the rendering process.