Skip to content

Svelte

Terminal window
npm install @kadal/deck-svelte svelte @sveltejs/vite-plugin-svelte
// vite.config.ts — deckSveltePlugin runs `enforce: "post"`, after svelte()
import { deckSveltePlugin } from "@kadal/deck-svelte/build";
import { svelte } from "@sveltejs/vite-plugin-svelte";
plugins: [
deck({ entry: "deck.mdx" }),
react(),
svelte({ compilerOptions: { runes: true } }),
deckSveltePlugin(),
];
src/main.tsx
registerLazyRenderer("svelte", () => import("@kadal/deck-svelte").then((m) => m.svelteRenderer));
<Island load={() => import("./chart.svelte")} props={{ data }} client="slide" />

No framework="svelte", and no stamp written by hand: that is the plugin’s whole job.

A production Svelte component is export default function Probe($$anchor, $$props) — a two-argument function with nothing in it that says Svelte. So the renderer has no owns() at all, and deckSveltePlugin() appends a stamp (Symbol.for("deck.renderer") = "svelte") to each compiled module instead. The stamp survives minification.

Props need a compiler. Svelte’s $state exists only in files the Svelte compiler sees, so the renderer’s reactive props bag lives in a .svelte.ts companion module compiled by your Svelte plugin. That is why the plugin is required, not optional.