import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import { tanstackStart } from '@tanstack/react-start/plugin/vite' // Plain TanStack Start config (Node target) — used for local sandbox dev. This // template is deploy-provider agnostic: it ships NO @cloudflare/vite-plugin. At // deploy, fabric CI injects the CF adapter (vite.config.cf.ts merges cloudflare() // on top of this config) to emit the CF Workers SSR bundle. Do not add cloudflare // here — that would double-apply it and couple the template to a provider. export default defineConfig({ plugins: [tanstackStart(), react()], server: { // Bind to 0.0.0.0 so the IPv4 loopback is reachable from Caddy's // reverse_proxy. Without this, Vite binds to ::1 (IPv6 localhost) in the // container because /etc/hosts lists ::1 before 127.0.0.1 in Node's // resolver order, causing Caddy's 127.0.0.1:port probe to be refused. host: '0.0.0.0', // Allow requests from any hostname (including nip.io reverse-proxy URLs // used in sandbox preview iframes). allowedHosts: true, }, })