Template
Initial commit of vite-chatgpt template
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
export default defineConfig(async ({ command, mode }) => {
|
||||
// OPENROUTER_API_KEY and friends are server-only, so they have no VITE_
|
||||
// prefix and Vite would not expose them. Load .env / .env.local into
|
||||
// process.env for the server code; variables already set win.
|
||||
Object.assign(process.env, loadEnv(mode, process.cwd(), ''));
|
||||
|
||||
return {
|
||||
server: { port: 3000 },
|
||||
plugins: [
|
||||
// Start must come before the React plugin.
|
||||
tanstackStart(),
|
||||
// Hosting adapter for `vite build`: Nitro packages Start's server for the
|
||||
// host (a Vercel Function when building on Vercel, a Node server in
|
||||
// .output/ elsewhere). Dev never loads it, so `vite dev` — and the
|
||||
// nodesandbox runtime — run plain Vite + TanStack Start + Hono.
|
||||
...(command === 'build'
|
||||
? [
|
||||
(await import('nitro/vite')).nitro({
|
||||
// Long agent runs stream for minutes (was `maxDuration` on the
|
||||
// Next route).
|
||||
vercel: { functions: { maxDuration: 300 } },
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
react(),
|
||||
tailwindcss(),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user