The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as Alchemy from "alchemy"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | |
| 5 | export default Alchemy.Stack( |
| 6 | "CloudflareWebsiteReactRouterExample", |
| 7 | { |
| 8 | providers: Cloudflare.providers(), |
| 9 | state: Cloudflare.state(), |
| 10 | }, |
| 11 | Effect.gen(function* () { |
| 12 | // React Router's RSC build emits multiple server environments (`rsc` |
| 13 | // and `ssr`); `viteEnvironments` tells Alchemy how they assemble into |
| 14 | // one Worker: the `rsc` environment is the Worker entry, and the `ssr` |
| 15 | // environment's chunks are bundled alongside so cross-environment |
| 16 | // `loadModule` calls resolve in the deployed Worker. |
| 17 | const site = yield* Cloudflare.Website.Vite("Website", { |
| 18 | compatibility: { |
| 19 | date: "2026-08-31", |
| 20 | }, |
| 21 | // Only hash the files that affect the build, so unchanged sources |
| 22 | // skip the Vite build (and the deploy) entirely. |
| 23 | memo: { |
| 24 | include: ["app/**", "react-router-vite/**", "public/**", "package.json", "vite.config.ts"], |
| 25 | }, |
| 26 | env: { |
| 27 | GREETING: "Hello from React Router on Cloudflare!", |
| 28 | }, |
| 29 | viteEnvironments: { |
| 30 | entry: "rsc", |
| 31 | children: ["ssr"], |
| 32 | }, |
| 33 | }); |
| 34 | |
| 35 | return { |
| 36 | url: site.url, |
| 37 | }; |
| 38 | }), |
| 39 | ); |