The best way to control Claude Code, Codex and more from any computer or phone
| 1 | // Mirrors `@cloudflare/vite-plugin`'s `playground/child-environment`. |
| 2 | declare global { |
| 3 | // In real world usage, this is accessed by `@vitejs/plugin-rsc` |
| 4 | function __VITE_ENVIRONMENT_RUNNER_IMPORT__( |
| 5 | environmentName: string, |
| 6 | id: string, |
| 7 | ): Promise<unknown>; |
| 8 | } |
| 9 | |
| 10 | export default { |
| 11 | async fetch(request) { |
| 12 | const childEnvironmentEntry = "./child/child-environment-module.js"; |
| 13 | const childEnvironmentModule = (await (typeof __VITE_ENVIRONMENT_RUNNER_IMPORT__ === "function" |
| 14 | ? __VITE_ENVIRONMENT_RUNNER_IMPORT__("child", "./src/child-environment-module") |
| 15 | : import(/* @vite-ignore */ childEnvironmentEntry))) as { |
| 16 | additionalModule: string; |
| 17 | getMessage: () => string; |
| 18 | }; |
| 19 | |
| 20 | return new Response( |
| 21 | new URL(request.url).pathname === "/additional-module" |
| 22 | ? childEnvironmentModule.additionalModule |
| 23 | : childEnvironmentModule.getMessage(), |
| 24 | ); |
| 25 | }, |
| 26 | } satisfies ExportedHandler; |