Skill Tracer
Skills › Compound Engineering › ce-polish › dev-server-vite.md

dev-server-vite.md

48 lines · skills/ce-polish/references/dev-server-vite.md at 3449230

Open on GitHub
1# Vite dev-server recipe (auto-detect fallback)
2
3Loaded when `detect-project-type.sh` returns `vite` and the startup tuple still lacks a command.
4

Vite dev-server recipe (auto-detect fallback)

Loaded when detect-project-type.sh returns vite and the startup tuple still lacks a command.

Raw lines 1 to 4
5## Signature
6
7- `vite.config.js`, `vite.config.ts`, `vite.config.mjs`, or `vite.config.cjs` exists
8

Signature

  • vite.config.js, vite.config.ts, vite.config.mjs, or vite.config.cjs exists
Raw lines 5 to 8
9## Start command
11Standard:
13```bash
14npm run dev
15```
17The `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).

Start command

Standard:

npm run dev

The 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).

Raw lines 9 to 18
19## Port
21Default: `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*`.
23Vite'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.

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.

Raw lines 19 to 24
25## Host binding
27Vite 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`.

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.

Raw lines 25 to 28
29## Stub generation
31```json
33 "version": "0.2.0",
34 "configurations": [
35 {
36 "name": "Vite dev",
37 "runtimeExecutable": "npm",
38 "runtimeArgs": ["run", "dev"],
39 "port": 5173
40 }
41 ]
43```

Stub generation

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Vite dev",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["run", "dev"],
      "port": 5173
    }
  ]
}
Raw lines 29 to 44
45## Common gotchas
47- **HMR websocket port:** Vite's HMR uses a separate websocket that inherits the dev-server port by default. If the project pins `server.hmr.port` in `vite.config.ts`, the polish reachability probe against the dev-server port still works, but the embedded browser may need additional configuration to reach HMR.
48- **Framework on top of Vite:** SvelteKit, SolidStart, Qwik City, and Astro all use Vite but add their own dev scripts. The `vite` signature catches them, and `npm run dev` is 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 from `package.json` or `.env`.

Common 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.port in vite.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 vite signature catches them, and npm run dev is 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 from package.json or .env.
Raw lines 45 to 48