1// TOP-LEVEL `cloudflare:workers` import in a statically rendered page: the
2// SSG step of `waku build` imports this module while prerendering, so the
3// build only succeeds when SSG runs inside workerd (the cloudflare vite
4// plugin's preview mode serving the freshly built worker). In Node, loading
5// the `cloudflare:` scheme throws ERR_UNSUPPORTED_ESM_URL_SCHEME.
6import { env } from "cloudflare:workers";
7
8export default async function SsgEnvPage() {
9 return (
10 <div>
11 <div data-testid="ssg-env-marker">SSG_ENV_MARKER</div>
12 <div data-testid="ssg-env-message">
13 MESSAGE={String(env.MESSAGE ?? "unset")}
14 </div>
15 </div>
16 );
17}
18
19// Static: prerendered at build time — with the binding value baked into the
20// emitted HTML, proving the SSG render had real worker bindings.
21export const getConfig = async () => ({ render: "static" }) as const;