close

Svelte

Learn how to build a Svelte application using Rsbuild.

Create a Svelte application

Create a Svelte application with create-rsbuild:

npm
yarn
pnpm
bun
npm create rsbuild@latest

Then select Svelte when prompted to "Select framework".

Use Svelte in an existing project

To compile Svelte components (.svelte files), you need to register the Rsbuild Svelte plugin. The plugin will automatically add the necessary configuration for Svelte builds.

For example, register the plugin in Rsbuild config:

rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
import { pluginSvelte } from '@rsbuild/plugin-svelte';

export default defineConfig({
  plugins: [pluginSvelte()],
});