Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

vite.config.ts

37 lines1.5 KB

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'
6import { modelschemas } from '@modelschemas/vite'
7​
8// Standalone by default (`bun run deploy` → your own workers.dev, app at
9// "/"); the modelschemas Cloudflare environment mounts this example at
10// modelschemas.com/examples/schema-studio/ via a zone route — see
11// wrangler.jsonc. Router basepath and server-fn base derive from `base`.
12const hosted = process.env.CLOUDFLARE_ENV === 'modelschemas'
13​
14// Schemas are pulled into src/modelschemas at dev time and committed;
15// `vite build` only verifies the files against .manifest.json (offline).
16export default defineConfig({
17 base: hosted ? '/examples/schema-studio/' : '/',
18 server: { port: 3201 },
19 plugins: [
20 cloudflare({ viteEnvironment: { name: 'ssr' } }),
21 modelschemas({
22 baseUrl: process.env.MODELSCHEMAS_URL ?? 'https://modelschemas.com',
23 selections: [
24 'anthropic/v1/messages#request',
25 'openrouter/chat/completions#request',
26 'openrouter/videos/google/veo-3.1#request',
27 'openrouter/audio/speech#request',
28 ],
29 // The generative-UI renderer consumes the schema JSON itself, so pull
30 // schema-const modules rather than generated TypeScript types.
31 types: false,
32 }),
33 tailwindcss(),
34 tanstackStart(),
35 viteReact(),
36 ],
37})