Installation

Install svelte-plugin-composer and wrap a Vite plugin stack.

Install composer as a development dependency.

deno add --dev npm:svelte-plugin-composer

Pass the Vite plugin list to compose() and keep SvelteKit in the position where it should run.

vite.config.ts
import { sveltekit } from "@sveltejs/kit/vite";
import { compose } from "svelte-plugin-composer";
import { defineConfig } from "vite";

import inspect from "vite-plugin-inspect";

export default defineConfig({
	plugins: compose([process.env.INSPECT ? inspect() : false, sveltekit()]),
});

Nested arrays and promised plugin presets are flattened recursively. false, null, and undefined entries are ignored, so conditional plugins do not need a separate filtering pass.

The root export and svelte-plugin-composer/vite expose the same compose function and types.

On this page