Open History to see the last commit
1import { existsSync } from 'node:fs'
2import { resolve } from 'node:path'
3import { defineConfig } from 'vite'
4import { tanstackStart } from '@tanstack/react-start/plugin/vite'
5import viteReact from '@vitejs/plugin-react'
6import tailwindcss from '@tailwindcss/vite'
7
8// Server routes read process.env. Vite does not copy unprefixed .env keys
9// into the SSR process. Load them here. Already-set vars win.
10for (const name of ['.env.local', '.env']) {
11 const path = resolve(import.meta.dirname, name)
12 if (existsSync(path)) process.loadEnvFile(path)
13}
14
15export default defineConfig({
16 resolve: { tsconfigPaths: true },
17 server: { port: 3101, host: '127.0.0.1' },
18 plugins: [tailwindcss(), tanstackStart(), viteReact()],
19})