1import * as Options from "@alchemy.run/cloudflare-test-tools/e2e/Options";
2
3/**
4 * A minimal Vite app with BOTH a client side (index.html + a counter whose
5 * marker string comes from an imported module) and a Worker (`main`, an
6 * `/api/marker` route whose marker string comes from an imported module).
7 *
8 * The point of this fixture is the dev-mode edit-propagation specs in
9 * test/smoke.test.ts: a client-module edit must arrive as a HOT update
10 * (counter state preserved — no full reload), and a worker-module edit must
11 * be reflected by the workerd-hosted Worker on a subsequent request.
12 */
13export default Options.make({
14 target: {
15 cloudflare: {
16 worker: {
17 // Worker entry, relative to the Vite root (the fixture root).
18 main: "./src/server.ts",
19 compatibilityDate: "2026-03-10",
20 compatibilityFlags: ["nodejs_compat"],
21 worker: {
22 name: "fixtures-vite-hmr",
23 bindings: [],
24 // Assets-aware dev routing: `/` resolves index.html through the
25 // vite-aware asset worker (`transformIndexHtml`, HMR client
26 // injected); `/api/*` has no asset and invokes the user Worker.
27 // `runWorkerFirst` deliberately omitted: the wrangler-matching
28 // default is assets first, so `/` resolves index.html through the
29 // vite-aware asset worker and `/api/*` falls through to the Worker.
30 assets: {
31 htmlHandling: "auto-trailing-slash",
32 notFoundHandling: "none",
33 },
34 },
35 },
36 // Preview (the Playwright `live` mode): assets first, Worker for
37 // everything the asset layer doesn't match — same routing semantics
38 // as dev.
39 preview: {
40 compatibilityDate: "2026-03-10",
41 compatibilityFlags: ["nodejs_compat"],
42 assets: {
43 routerConfig: {
44 has_user_worker: true,
45 invoke_user_worker_ahead_of_assets: false,
46 },
47 assetConfig: {
48 html_handling: "auto-trailing-slash",
49 not_found_handling: "none",
50 },
51 },
52 },
53 },
54 },
55});