Open-Source Wikis

/

Svelte

/

Svelte

/

Getting started

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.json declares pnpm@10.4.0 as 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 install

The 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.js and warnings.js (auto-generated from packages/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 test

Test 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 --watch

Note 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 --write

Lint 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-brk

Try 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

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Getting started – Svelte wiki | Factory