| 1 | import { createElement } from "react"; |
| 2 | import { renderToStaticMarkup } from "react-dom/server.edge"; |
| 3 | |
| 4 | // Lives in the `ssr` environment (no `react-server` condition), so it can use |
| 5 | // `react-dom/server` — which would fail if imported directly in the worker's |
| 6 | // `rsc` entry. The worker reaches it via `loadModule("ssr", "worker-ssr")`. |
| 7 | // This is the pattern James Opstad landed on in |
| 8 | // github.com/agcty/vite-rsc-worker-env-repro PR #1. |
| 9 | export function renderWorkerHtml(): string { |
| 10 | return renderToStaticMarkup( |
| 11 | createElement("section", null, "Worker render via the ssr environment."), |
| 12 | ); |
| 13 | } |