Skip to content

Function: xmSvelteRunes()

API / @xmachines/shared / vite-aliases / xmSvelteRunes

function xmSvelteRunes(): object;

Defined in: vite-aliases.ts:317

Svelte plugin options that enforce runes mode for workspace sources only.

Forcing compilerOptions.runes globally also applies to third-party .svelte files pulled in through Vite dependency optimization — e.g. @testing-library/svelte-core’s wrapper-scaffold-legacy.svelte, which is intentionally written in legacy syntax and fails to compile in runes mode. Scoping the flag with dynamicCompileOptions keeps the strictness for our own components while letting node_modules compile in their intended mode.

Usage:

import { svelte } from “@sveltejs/vite-plugin-svelte”; import { xmSvelteRunes } from “@xmachines/shared/vite-aliases”;

export default defineConfig({ plugins: [svelte(xmSvelteRunes())] });

packages/play-svelte/svelte.config.js states the same policy a second time, because that file is published and this package is not — see tests/svelte-runes-policy.test.ts, which holds the two together. Change one and change the other.

Returns

object

NameTypeDefined in
dynamicCompileOptions()(data) => | { runes: boolean; } | undefinedvite-aliases.ts:318