1.8 KiB
1.8 KiB
Astro dev-server recipe (auto-detect fallback)
Loaded when detect-project-type.sh returns astro and there is no .claude/launch.json to consult.
Signature
astro.config.js,astro.config.mjs, orastro.config.tsexistspackage.jsoncontains anastrodependency
Start command
Standard:
npm run dev
The dev script in package.json typically wraps astro dev. 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: 4321. Astro respects --port <port> and the server.port field in astro.config.*. Overrides follow the cascade in references/dev-server-detection.md.
Stub generation
{
"version": "0.2.0",
"configurations": [
{
"name": "Astro dev",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "dev"],
"port": 4321
}
]
}
Substitute the resolved package manager (npm / pnpm / yarn / bun) and port.
Common gotchas
- SSR vs SSG:
astro devruns identically for both output modes; the difference only matters at build time. Polish does not need to distinguish between them. - Astro config takes precedence over Vite config: Astro uses Vite under the hood but ships its own config file. The
astrotype takes precedence overvitewhen bothastro.config.*andvite.config.*exist. This is rare -- Astro projects do not usually have a separate Vite config file. - Dev toolbar (Astro 4+): Astro 4+ includes a dev toolbar that adds overlay UI in the browser. It does not affect port binding or URL routing -- polish can ignore it.