sveltejs/kit · error · Error

To enable ${feature_name}, add the following to your SvelteK

Error message

To enable ${feature_name}, add the following to your SvelteKit plugin in `vite.config.js`:\n\n${result}

What it means

Configuration helper used across the SvelteKit Vite plugin: when a feature is detected in use (e.g. remote functions) but its required config flag is absent, error_for_missing_config renders the exact nested snippet to add — building the config path with indentation around a placeholder hole — and throws it stackless so the user can copy-paste the fix into their vite.config.js.

Source

Thrown at packages/kit/src/exports/vite/utils.js:226

 *	}
 *\`\`\`
 *```
 * @param {string} feature_name
 * @param {string} path
 * @param {string} value
 * @returns {never}
 */
export function error_for_missing_config(feature_name, path, value) {
	const hole = '__HOLE__';

	const result = path.split('.').reduce((acc, part, i, parts) => {
		const indent = '  '.repeat(i);
		const rhs = i === parts.length - 1 ? value : `{\n${hole}\n${indent}}`;

		return acc.replace(hole, `${indent}${part}: ${rhs}`);
	}, hole);

	throw stackless(
		dedent`\
			To enable ${feature_name}, add the following to your SvelteKit plugin in \`vite.config.js\`:

			${result}
		`
	);
}

/** @type {EnforcedConfig} */
export const enforced_config = {
	appType: true,
	base: true,
	build: {
		cssCodeSplit: true,
		emptyOutDir: true,
		lib: {
			entry: true,
			name: true,

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Add the printed config snippet to the SvelteKit plugin options in vite.config.js
  2. Set the suggested flag (e.g. experimental: { remoteFunctions: true }) matching the documented value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/exports/vite/utils.js:226 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/0bbf180b7ad2829a. Report an issue: GitHub.