glam/frontend/vite.config.ts
2025-12-10 23:51:51 +01:00

74 lines
1.8 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
logLevel: 'info',
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
build: {
// Increase chunk size warning limit (mermaid is large)
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
// Manual chunks to separate large dependencies
manualChunks: {
maplibre: ['maplibre-gl'],
},
},
},
},
optimizeDeps: {
include: ['maplibre-gl'],
// Exclude mermaid from pre-bundling - it's dynamically imported
exclude: ['mermaid'],
},
server: {
port: 5173,
proxy: {
// PostgreSQL API proxy
'/api/postgres': {
target: 'http://localhost:3001',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/postgres/, ''),
},
// DuckLake API proxy
'/ducklake': {
target: 'http://localhost:8765',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/ducklake/, ''),
},
// Generic API fallback
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
},
// Oxigraph SPARQL endpoint proxy
'/sparql': {
target: 'http://127.0.0.1:7878',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/sparql/, ''),
},
},
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: './tests/setup.ts',
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
exclude: [
'node_modules/',
'tests/',
'**/*.test.{ts,tsx}',
'**/*.spec.{ts,tsx}',
],
},
},
});