39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
/// <reference types="vitest/config" />
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { defineConfig } from 'vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [react(), tailwindcss()],
|
|
test: {
|
|
environment: 'jsdom',
|
|
// Give jsdom a real origin so the client's relative `/api/...` fetches
|
|
// resolve to an absolute URL MSW can intercept.
|
|
environmentOptions: { jsdom: { url: 'http://localhost' } },
|
|
globals: true,
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
// Keep the future Playwright e2e suite out of the Vitest run.
|
|
exclude: ['**/node_modules/**', '**/dist/**', 'e2e/**'],
|
|
},
|
|
server: {
|
|
host: '0.0.0.0',
|
|
port: 5173,
|
|
strictPort: true,
|
|
// Polling + explicit HMR client port make file-watch and the HMR
|
|
// websocket work reliably when Vite runs inside a (podman) container.
|
|
watch: { usePolling: true },
|
|
hmr: { clientPort: 5173 },
|
|
allowedHosts: true,
|
|
proxy: {
|
|
// Browser hits same-origin /api; Vite forwards to the backend service
|
|
// on the compose network (service name `php`, internal port 80) so the
|
|
// session cookie flows. NOT localhost:8100 — that is the host, not this
|
|
// container.
|
|
'/api': {
|
|
target: 'http://php:80',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|