From face5b416125cb554b2749071455f7a565d5d29b Mon Sep 17 00:00:00 2001 From: Steven RYDELL Date: Sat, 1 Aug 2026 21:58:16 +0200 Subject: [PATCH] fix(dev): respect $PORT env var in vite.config.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- vite.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vite.config.ts b/vite.config.ts index a0dd8d1..3f58a43 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -16,6 +16,9 @@ export default defineConfig({ }, }, 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: {