§ setup · getting started ~3 minutes

Getting Started.

Add the plugin and Vite DevTools to a Svelte 5 project on Vite 8.3.5 or later. It runs only in the dev server; production builds are unaffected.

Requirements

Vite
8.3.5 or later
Svelte
5.46.4 or later
SvelteKit
3.3.0 or later, optional: Routes, Load functions, API and Build need it
@vitejs/devtools
0.8.3 or later, for the Vite DevTools dock
Node.js
22 or later
01

Install

Install the plugin and Vite DevTools.

bash bash
npm install -D @sveltejs/vite-devtools-svelte @vitejs/devtools
02

Configure Vite

Turn on Vite DevTools with Vite's devtools option and add the plugin to your vite.config.ts. apply: 'serve' keeps Vite DevTools out of vite build. svelteDevtools() must come before sveltekit() so its transforms run before the Svelte compiler.

vite.config.ts ts
import { svelteDevtools } from '@sveltejs/vite-devtools-svelte'
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'

export default defineConfig({
  devtools: { apply: 'serve' },
  plugins: [svelteDevtools(), sveltekit()],
})
03

Open the dock

bash bash
npm run dev

Open your app, click the floating Vite DevTools handle and open the Svelte tools group. It has Overview, Problems, Inspect, Profile and Project, the Svelte Inspector (Pick element and Inspector settings), and Add, which installs sv add-ons.

Vite DevTools signs in the browser once for the whole dock (to skip it on a single-user machine, see below). The Svelte Inspector loads after that: hold alt-x in your app and click an element to open its source in your editor.

If you use vite-plugin-svelte's own inspector (vitePlugin.inspector), turn it off: the dev server does not start with both.

04

Without Vite DevTools

Without @vitejs/devtools, install only the plugin and leave out the devtools option. The panels then open on their own page at /.svelte-devtools/, and the dev server prints its URL. The Svelte Inspector and the Add panel need the dock.

bash bash
npm install -D @sveltejs/vite-devtools-svelte

The first time, the page asks for a one-time code: the dev server prints a 6-digit code and a link in the terminal. Type the code, or open the link. That browser is then trusted, also after reloads and dev-server restarts.

On a single-user machine where the dev server only listens on localhost, you can skip the code with svelteDevtools({ clientAuth: false }), or devtools: { apply: 'serve', clientAuth: false } for the dock. Without it, any page or device that can reach the dev server can read your project files through the DevTools, so keep it on if you are unsure.

05

Options

ts ts
svelteDevtools({
  // Track component instances and their state (default: true)
  componentTracking: true,
  // Ask for the one-time code on /.svelte-devtools/ (default: true)
  clientAuth: true,
  // Svelte Inspector options (dock only)
  inspector: { toggleKeyCombo: 'alt-x', holdMode: true },
})

inspector also takes navKeys, openKey, openMenuKey, escapeKeys and customStyles.

Next steps