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.
This commit is contained in:
@@ -16,6 +16,9 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
server: {
|
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
|
// Same-origin proxy to the local Stalwart container: avoids CORS entirely
|
||||||
// (VITE_API_BASE_URL stays empty in .env.development.local).
|
// (VITE_API_BASE_URL stays empty in .env.development.local).
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|||||||
Reference in New Issue
Block a user