Files
Stalwart-webui/vite.config.ts
T
Steven RYDELL face5b4161 fix(dev): respect $PORT env var in vite.config.ts
Preview/dev tooling that assigns a free port via $PORT (because the
project's usual 5173 is taken) had no way to make Vite actually bind
there — Vite ignores PORT by default and falls back to its own
auto-increment, so the dev server would come up on a different port
than the one the tooling proxied to.
2026-08-01 21:58:34 +02:00

38 lines
1.1 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import path from 'path'
import { version } from './package.json'
export default defineConfig({
base: './',
define: {
__APP_VERSION__: JSON.stringify(version),
},
plugins: [react(), tailwindcss()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
// Preview tooling assigns a free port via $PORT; fall back to Vite's
// own default for plain `npm run dev`.
port: process.env.PORT ? Number(process.env.PORT) : 5173,
// Same-origin proxy to the local Stalwart container: avoids CORS entirely
// (VITE_API_BASE_URL stays empty in .env.development.local).
proxy: {
'/api': { target: 'http://localhost:8080', changeOrigin: true, ws: true },
'/jmap': { target: 'http://localhost:8080', changeOrigin: true, ws: true },
},
watch: {
// Release artifacts lock on Windows and crash the watcher (EBUSY).
ignored: ['**/webui.zip', '**/release_body.md'],
},
},
test: {
globals: false,
environment: 'happy-dom',
},
})