import { fileURLToPath } from "node:url"; import { defineConfig } from "vite"; import tailwindcss from "@tailwindcss/vite"; import tsConfigPaths from "vite-tsconfig-paths"; import react from "@vitejs/plugin-react"; import { tanstackStart } from "@tanstack/react-start/plugin/vite"; import { nitro } from "nitro/vite"; export default defineConfig(({ command }) => ({ css: { transformer: "lightningcss" }, resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) }, dedupe: [ "react", "react-dom", "react/jsx-runtime", "react/jsx-dev-runtime", "@tanstack/react-query", "@tanstack/query-core", ], }, optimizeDeps: { include: ["react", "react-dom", "react-dom/client", "react/jsx-runtime", "react/jsx-dev-runtime"], }, server: { host: "::", port: 8080, }, plugins: [ tailwindcss(), tsConfigPaths({ projects: ["./tsconfig.json"] }), tanstackStart({ server: { entry: "server" }, }), // Node HTTP server output, not a Cloudflare Worker: the Dockerfile runs // this with plain `node`, so the build must target node-server. ...(command === "build" ? [nitro({ preset: "node-server" })] : []), react(), ], }));