Skills › Compound Engineering › ce-polish › dev-server-sveltekit.md
dev-server-sveltekit.md
58 lines · skills/ce-polish/references/dev-server-sveltekit.md at 3449230
1# SvelteKit dev-server recipe (auto-detect fallback)
3Loaded when `detect-project-type.sh` returns `sveltekit` and the startup tuple still lacks a command.
SvelteKit dev-server recipe (auto-detect fallback)
Loaded when detect-project-type.sh returns sveltekit and the startup tuple still lacks a command.
5## Signature
7- `svelte.config.js`, `svelte.config.mjs`, or `svelte.config.ts` exists
8- `package.json` contains a `@sveltejs/kit` dependency
Signature
svelte.config.js,svelte.config.mjs, orsvelte.config.tsexistspackage.jsoncontains a@sveltejs/kitdependency
10## Start command
12Standard:
14```bash
15npm run dev
16```
18The `dev` script in `package.json` typically wraps `vite dev` via SvelteKit. Also valid (read `package.json` scripts to confirm which the project uses):
20```bash
21pnpm dev
22yarn dev
23bun run dev
24```
26Prefer the package manager indicated by the lockfile:
27- `pnpm-lock.yaml` -> `pnpm dev`
28- `yarn.lock` -> `yarn dev`
29- `bun.lock` / `bun.lockb` -> `bun run dev`
30- `package-lock.json` or none -> `npm run dev`
Start command
Standard:
npm run devThe dev script in package.json typically wraps vite dev via SvelteKit. Also valid (read package.json scripts to confirm which the project uses):
pnpm dev
yarn dev
bun run devPrefer the package manager indicated by the lockfile:
pnpm-lock.yaml->pnpm devyarn.lock->yarn devbun.lock/bun.lockb->bun run devpackage-lock.jsonor none ->npm run dev
32## Port
34Default: `5173` (inherited from Vite). SvelteKit respects `--port <port>` flag and Vite's `server.port` config in `vite.config.ts`. Overrides follow the cascade in `references/dev-server-detection.md`.
Port
Default: 5173 (inherited from Vite). SvelteKit respects --port <port> flag and Vite's server.port config in vite.config.ts. Overrides follow the cascade in references/dev-server-detection.md.
36## Stub generation
38```json
39{
40 "version": "0.2.0",
41 "configurations": [
42 {
43 "name": "SvelteKit dev",
44 "runtimeExecutable": "npm",
45 "runtimeArgs": ["run", "dev"],
46 "port": 5173
47 }
48 ]
49}
50```
52Substitute the resolved package manager (`npm` / `pnpm` / `yarn` / `bun`) and port.
Stub generation
{
"version": "0.2.0",
"configurations": [
{
"name": "SvelteKit dev",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"port": 5173
}
]
}Substitute the resolved package manager (npm / pnpm / yarn / bun) and port.
54## Common gotchas
56- **Vite under the hood:** SvelteKit uses Vite internally -- same port default (5173), same HMR behavior. The `sveltekit` type exists because `svelte.config.js` is a more precise signal than a generic `vite.config.ts`, allowing polish to generate a SvelteKit-specific stub name and label.
57- **Adapter does not matter for dev:** `adapter-auto`, `adapter-node`, `adapter-static`, and other adapters all produce the same dev server. The adapter only affects the production build output.
58- **`svelte.config.js` is the primary signature:** `svelte.config.js` always exists in SvelteKit projects, even when `vite.config.ts` also exists. This is the file that distinguishes a SvelteKit project from a plain Vite project.
Common gotchas
- Vite under the hood: SvelteKit uses Vite internally -- same port default (5173), same HMR behavior. The
sveltekittype exists becausesvelte.config.jsis a more precise signal than a genericvite.config.ts, allowing polish to generate a SvelteKit-specific stub name and label. - Adapter does not matter for dev:
adapter-auto,adapter-node,adapter-static, and other adapters all produce the same dev server. The adapter only affects the production build output. - **
svelte.config.jsis the primary signature:**svelte.config.jsalways exists in SvelteKit projects, even whenvite.config.tsalso exists. This is the file that distinguishes a SvelteKit project from a plain Vite project.