dev-server-vite.md
48 lines · skills/ce-polish/references/dev-server-vite.md at 3449230
Vite dev-server recipe (auto-detect fallback)
Loaded when detect-project-type.sh returns vite and the startup tuple still lacks a command.
Start command
Standard:
npm run devThe dev script in package.json typically wraps vite directly. Prefer the package manager indicated by the lockfile (see the Next.js recipe for the lockfile → command mapping).
Port
Default: 5173. Vite respects --port <n> and the VITE_PORT env var. The cascade in references/dev-server-detection.md picks up --port from package.json scripts and PORT from .env*.
Vite's --strictPort flag causes the dev server to fail rather than increment to the next available port when the requested port is in use. Without it, an occupied port may move the server away from the URL polish probes; treat that reachability failure as a start-configuration decision for the user.
Host binding
Vite binds to 127.0.0.1 by default. For polish running inside a devcontainer or WSL, users may need --host 0.0.0.0 in runtimeArgs.
Stub generation
{
"version": "0.2.0",
"configurations": [
{
"name": "Vite dev",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"port": 5173
}
]
}Raw lines 29 to 44Common gotchas
- HMR websocket port: Vite's HMR uses a separate websocket that inherits the dev-server port by default. If the project pins
server.hmr.portinvite.config.ts, the polish reachability probe against the dev-server port still works, but the embedded browser may need additional configuration to reach HMR. - Framework on top of Vite: SvelteKit, SolidStart, Qwik City, and Astro all use Vite but add their own dev scripts. The
vitesignature catches them, andnpm run devis the right command for all of them. Different default ports apply (SvelteKit: 5173, Astro: 4321, Qwik: 5173) — rely on the cascade to pick up the actual port frompackage.jsonor.env.