teg/frontend/vite.config.ts
2026-06-15 20:59:44 +02:00

32 lines
753 B
TypeScript

import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
const certDir = fileURLToPath(new URL('./certs/', import.meta.url))
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
],
server: {
host: true,
strictPort: true,
https: {
cert: readFileSync(`${certDir}localhost.pem`),
key: readFileSync(`${certDir}localhost-key.pem`),
},
proxy: {
'/api': {
target: 'http://localhost:8080',
changeOrigin: true,
ws: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
})