59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'path'
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
optimizeDeps: {
|
|
include: ['dompurify'],
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
// Direct requests to FastAPI backend - no proxy needed
|
|
},
|
|
build: {
|
|
// Disable source maps in production for security
|
|
sourcemap: false,
|
|
// Production optimizations
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true, // Remove console.log in production
|
|
drop_debugger: true,
|
|
},
|
|
},
|
|
// Ensure client-side rendering only - no static generation
|
|
ssr: false,
|
|
// Build as SPA (Single Page Application)
|
|
rollupOptions: {
|
|
output: {
|
|
// Ensure all assets are properly chunked for runtime loading
|
|
manualChunks: undefined,
|
|
},
|
|
},
|
|
// Ensure all environment variables are available at runtime
|
|
// Vite already handles this, but we're being explicit
|
|
target: 'esnext',
|
|
// Don't inline assets - fetch them at runtime
|
|
assetsInlineLimit: 0,
|
|
},
|
|
// Vitest configuration (separate from Vite config)
|
|
// @ts-ignore - Vitest types are not always properly recognized
|
|
test: {
|
|
globals: true,
|
|
environment: 'jsdom',
|
|
setupFiles: './src/test/setup.ts',
|
|
css: true,
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html'],
|
|
},
|
|
},
|
|
})
|