Skill Tracer
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

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

SvelteKit dev-server recipe (auto-detect fallback)

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

Raw lines 1 to 4
5## Signature
6
7- `svelte.config.js`, `svelte.config.mjs`, or `svelte.config.ts` exists
8- `package.json` contains a `@sveltejs/kit` dependency
9

Signature

  • svelte.config.js, svelte.config.mjs, or svelte.config.ts exists
  • package.json contains a @sveltejs/kit dependency
Raw lines 5 to 9
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 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 dev
  • yarn.lock -> yarn dev
  • bun.lock / bun.lockb -> bun run dev
  • package-lock.json or none -> npm run dev
Raw lines 10 to 31
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.

Raw lines 32 to 35
36## Stub generation
38```json
40 "version": "0.2.0",
41 "configurations": [
42 {
43 "name": "SvelteKit dev",
44 "runtimeExecutable": "npm",
45 "runtimeArgs": ["run", "dev"],
46 "port": 5173
47 }
48 ]
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.

Raw lines 36 to 53
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 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.
  • 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.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.
Raw lines 54 to 58