- Vite react-ts project con base: '/postgenerator/' (Pitfall #9 risolto) - Tailwind v4 via @tailwindcss/vite plugin + @import "tailwindcss" in index.css - react-router-dom con BrowserRouter basename="/postgenerator" - @tanstack/react-query con QueryClientProvider - lucide-react installato per icone - src/api/client.ts: API_BASE='/postgenerator/api', apiFetch<T> con error handling - Dev proxy: /postgenerator/api -> http://localhost:8000 (strip /postgenerator) - App.tsx: HomePage placeholder "Setup completo", struttura Routes pronta - Build Vite: 253.90kB JS + 5.53kB CSS, nessun errore TypeScript
24 lines
672 B
TypeScript
24 lines
672 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
|
|
// CRITICAL: base path must match the nginx subpath and FastAPI root_path
|
|
base: '/postgenerator/',
|
|
|
|
server: {
|
|
proxy: {
|
|
// In dev, proxy /postgenerator/api -> localhost:8000/api
|
|
// rewrite strips the /postgenerator prefix so FastAPI sees /api/...
|
|
'/postgenerator/api': {
|
|
target: 'http://localhost:8000',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace('/postgenerator', ''),
|
|
},
|
|
},
|
|
},
|
|
})
|