feat(01-01): React + Vite + Tailwind v4 SPA scaffold con API client
- 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
This commit is contained in:
23
frontend/vite.config.ts
Normal file
23
frontend/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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', ''),
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user