sveltejs/svelte
Getting started
Active contributors: Rich Harris, Ben McCann, Simon H
Prerequisites
- Node.js — CI runs against 18, 20, 22, and 24 (
.github/workflows/ci.yml). Local dev typically uses 22+. - pnpm ≥ 9 (
package.jsondeclarespnpm@10.4.0as the package manager). The repo is a pnpm workspace; don't use npm or yarn at the root. - Chromium for browser tests — installed via
pnpm playwright install chromium.
Install
git clone https://github.com/sveltejs/svelte
cd svelte
pnpm installThe workspace declaration is in pnpm-workspace.yaml and pulls in packages/* and playgrounds/*.
Build the package
The published svelte package is built with Rollup (packages/svelte/rollup.config.js). The build also generates .d.ts files via dts-buddy and processes human-readable error/warning messages into JS modules.
cd packages/svelte
pnpm build # one-shot build
pnpm dev # rebuild on file change (watch mode for both rollup and process-messages)Generated artifacts:
packages/svelte/compiler/index.js(UMD compiler bundle for in-browser use)packages/svelte/types/index.d.ts(rolled-up types)packages/svelte/src/compiler/errors.jsandwarnings.js(auto-generated frompackages/svelte/messages/)
Run tests
The test runner is Vitest, configured in vitest.config.js. The most common patterns are documented in CONTRIBUTING.md:
# Top-level: run everything
pnpm test
# Run a particular suite
pnpm test validator
# Filter within a suite
pnpm test validator -t a11y-alt-text
# Update expected snapshots (parser, snapshot suites)
UPDATE_SNAPSHOTS=true pnpm testTest areas under packages/svelte/tests/ include runtime-runes, runtime-legacy, runtime-browser, server-side-rendering, validator, parser-modern, parser-legacy, migrate, signals, sourcemaps, and several CSS-only suites. See Testing for more detail.
Type-check
cd packages/svelte
pnpm check # builds first, then runs tsc on src + tests/types
pnpm check:watch # tsc --watchNote that pnpm check at the repo root (in the top-level package.json) builds the package and then runs pnpm -r check across the workspace.
Lint and format
pnpm lint # eslint + prettier --check
pnpm format # prettier --writeLint config lives in eslint.config.js (top-level), which also pulls in eslint-plugin-svelte and eslint-plugin-lube.
Run benchmarks
Benchmarks live under benchmarking/:
pnpm bench # run all benchmarks under NODE_ENV=production
pnpm bench:compare # compare current branch against another reference
pnpm bench:debug # run with --inspect-brkTry a playground
playgrounds/ contains small Svelte apps wired up to use the workspace copy of svelte. Useful for poking at compiler output and runtime behaviour without spinning up a SvelteKit project.
Next steps
- Read Architecture to see where each piece lives.
- Look at How to contribute before opening a PR (small PRs only, changesets required).
- Browse the Compiler and Reactivity engine pages for the two most active subsystems.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.