2.0 KiB
2.0 KiB
SvelteKit dev-server recipe (auto-detect fallback)
Loaded when detect-project-type.sh returns sveltekit and there is no .claude/launch.json to consult.
Signature
svelte.config.js,svelte.config.mjs, orsvelte.config.tsexistspackage.jsoncontains a@sveltejs/kitdependency
Start command
Standard:
npm run dev
The 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 dev
Prefer 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
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.
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.
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.