Open History to see the last commit
1import { defineConfig } from 'vite'
2import { tanstackStart } from '@tanstack/react-start/plugin/vite'
3import viteReact from '@vitejs/plugin-react'
4import tailwindcss from '@tailwindcss/vite'
5import { cloudflare } from '@cloudflare/vite-plugin'
6
7// Standalone by default: clone the repo, `bun run build && wrangler deploy`,
8// and the app runs at the root of your own workers.dev subdomain. The
9// `modelschemas` Cloudflare environment (CLOUDFLARE_ENV=modelschemas, see
10// wrangler.jsonc) is how the canonical deployment mounts this example at
11// modelschemas.com/examples/image-dimensions/ — a zone route more specific
12// than the main site's custom domain sends those requests here. The router
13// basepath and server-fn base both derive from vite `base`.
14const hosted = process.env.CLOUDFLARE_ENV === 'modelschemas'
15
16export default defineConfig({
17 base: hosted ? '/examples/image-dimensions/' : '/',
18 server: { port: 3202 },
19 plugins: [
20 cloudflare({ viteEnvironment: { name: 'ssr' } }),
21 tailwindcss(),
22 tanstackStart(),
23 viteReact(),
24 ],
25})