Files
zui/frontend/vite.config.ts
2026-03-11 14:39:38 +01:00

48 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
server: {
proxy: {
// Backend API (dev): proxy to avoid CORS
'/api/todos': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'/api/todos/': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'/health': {
target: 'http://localhost:8080',
changeOrigin: true,
},
'/api/agent': {
target: 'http://localhost:8080',
changeOrigin: true,
},
// Kroki diagram service
'/api/kroki': {
target: 'https://kroki.io',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api\/kroki/, ''),
},
},
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
// Ensure PostCSS/Vite can resolve the shadcn tailwind CSS file
'shadcn/dist/tailwind.css': path.resolve(
__dirname,
'node_modules/shadcn/dist/tailwind.css'
),
// Optional: map the package to its dist for other imports
shadcn: path.resolve(__dirname, 'node_modules/shadcn/dist'),
}
}
})