import { octane } from "@octanejs/vite-plugin"; import { defaultClientConditions, defineConfig } from "vite"; export default defineConfig(({ isSsrBuild }) => ({ plugins: [octane()], build: { target: "esnext" }, resolve: { dedupe: ["octane"] }, // The Cloudflare adapter builds the server bundle for a webworker target, // which Vite resolves with browser conditions. Packages such as // @tanstack/router-core ship server variants keyed by `workerd`/`worker`, // so list those first for the server build. ...(isSsrBuild ? { ssr: { resolve: { conditions: ["workerd", "worker", ...defaultClientConditions], }, }, } : {}), }));