I’ve been out of the web frontend loop for a while. Is Next.js still the only viable option for ReScript? No-fuss HTML from a server is what I’m after. Not married to React, though.
If you don’t care about having an actual fleshed out client framework like React, just want to produce HTML with a little bit of interactivity, but still want to use JSX and the component approach, I built ResX a while ago: https://github.com/zth/res-x
It’s working quite well and it’s in production successfully in a couple of places. Refreshing to more or less just produce HTML, but still get to use the component approach and JSX.
I’m really unhappy with nextjs (with TypeScript) and it’s not straight forward to use it in ReScript.
Unfortunately I have to use it at work in more or less every project.
So I started to build a small framework, which should proof, that web frameworks doesn’t have to be as complex as next, remix, etc.
It just renders html and serves minimal js and css files per page.
Don’t expect too much, it’s just a proof of concept. Maybe I will try to build this hyped https://www.mcmaster.com page with it.
@zth @dkirchhof while it’s tempting to simplify things, too many unknowns for me these days. I would have tried it out 5 years ago though
Also, Bun is a show-stopper as I deploy to Cloudflare.
Hey, @zth I tried using res-x as a part of monorepo that is built with Rewatch. The problem is Rewatch seems to want to panic during the build. I’m guessing it does not like having both react and hjsx in the same project. Do you think this is a possibility or should I just revisit my configs?
The error looks like this
[1/7]📦 Building package tree...thread '<unnamed>' panicked at src/bsconfig.rs:238:10:
Errors reading bsconfig: "Could not parse bsconfig. /path/to/packages/resx-site/rescript.json - unknown variant `Hjsx`, expected `react` at line 36 column 20"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Had the same issue. Opened a ticket a while ago.
@TomiS they fixed the rewatch bug. Unfortunately now the compiler complains about jsx syntax (“The value div can’t be found”). Don’t know if it has something to do with my general monorepo setup.
If you try out res-x again, let me know if the issue is gone
EDIT: might be this issue: pnpm monorepo support - ppx resolution failing · Issue #104 · rescript-lang/rewatch · GitHub
Yep, indeed the latest rewatch master tries to build it. But I’m getting a handful of errors similar to this: The field hxBoost does not belong to type JsxDOM.domProps
. So it appears it doesn’t understand htmx attributes or something.