54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
// Custom plugin for automatic Zod validation in development
|
|
function zodAutoValidation() {
|
|
return {
|
|
name: 'zod-auto-validation',
|
|
transform(code: string, id: string) {
|
|
// Only apply in development/test environments
|
|
if (process.env.NODE_ENV === 'production') {
|
|
return null
|
|
}
|
|
|
|
// Add automatic validation for functions with Zod schemas
|
|
if (id.includes('src/') && id.endsWith('.ts')) {
|
|
// This would normally be a more sophisticated transform
|
|
// For now, we rely on our AutoValidator pattern
|
|
return null
|
|
}
|
|
|
|
return null
|
|
}
|
|
}
|
|
}
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
zodAutoValidation()
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
}
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://backend:8000',
|
|
changeOrigin: true,
|
|
rewrite: (path: string) => path.replace(/^\/api/, '')
|
|
}
|
|
}
|
|
},
|
|
define: {
|
|
// Enable automatic validation in development
|
|
__AUTO_VALIDATE__: JSON.stringify(process.env.NODE_ENV !== 'production')
|
|
}
|
|
})
|