Customize the Vite dev server port and force strict port behavior (server.port / strictPort)

domain: vite.dev · 4 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Set server.port to the desired number (default 5173) in vite.config.
  2. If you need the exact port or nothing: set server.strictPort: true so Vite exits instead of auto-incrementing when the port is occupied.
  3. Override on the CLI: use --port to set the port and --strictPort to force it.
  4. Start the dev server and confirm it binds to the requested port (or exits if strictPort and it is taken).

Known gotchas

Related routes

Disable or customize the Vite dev error overlay and WebSocket HMR settings (server.hmr / server.ws)
vite.dev · 4 steps · unrated
Control the Vite dev server CORS policy (server.cors) for cross-origin browser clients
vite.dev · 4 steps · unrated
Expose the Vite dev server to your LAN or network (server.host / --host) and secure allowed hosts
vite.dev · 6 steps · unrated

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans