sveltejs/kit · warning

The following plugins may not work correctly because they us

Error message

The following plugins may not work correctly because they use the `transformIndexHtml` hook which is not supported:

${list}

What it means

In `configResolved`, the Vite plugin detects plugins using the `transformIndexHtml` hook, which SvelteKit does not support because it controls the HTML shell itself, and warns listing the offending plugin names.

Source

Thrown at packages/kit/src/exports/vite/index.js:585

		/**
		 * Stores the final config.
		 */
		configResolved(config) {
			if (!is_build) {
				// Dependency scanning starts before configureServer creates the full manifest
				write_app_manifest(`${out_dir}/generated/dev`, undefined, false);
			}

			const unsupported_plugins = config.plugins.filter((plugin) => plugin.transformIndexHtml);
			if (unsupported_plugins.length) {
				const verbose = config.logLevel === 'info' || config.logLevel === undefined;
				const log = logger({ verbose });

				const list = unsupported_plugins
					.map((plugin) => `  - ${plugin.name || '(missing plugin name)'}`)
					.join('\n');

				log.warn(
					dedent`
						The following plugins may not work correctly because they use the \`transformIndexHtml\` hook which is not supported:

						${list}
					`
				);
			}
		},

		/**
		 * Adds the SvelteKit middleware to do SSR in dev mode.
		 * @see https://vitejs.dev/guide/api-plugin.html#configureserver
		 */
		async configureServer(server) {
			return await dev(
				vite,
				server,
				svelte_config,

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Remove the plugin or find a SvelteKit-native alternative (e.g. use `%sveltekit.head%` / app.html or a `handle` hook)
  2. If the plugin's feature is needed, implement it in src/hooks.server.js by transforming HTML in the `handle` hook
  3. Check if the plugin offers a SvelteKit-compatible mode or newer version without transformIndexHtml

Example fix

// before (vite.config.js)
plugins: [sveltekit(), htmlInjectPlugin()]
// after
plugins: [sveltekit()] // move injection logic into app.html or a handle hook
Defensive patterns

Strategy: validation

Validate before calling

// audit plugins for unsupported hooks before configuring
import { readFileSync } from 'node:fs';
const pluginsDir = 'node_modules';
// simpler: grep your vite.config plugin packages for transformIndexHtml in their dist
// e.g. `grep -r "transformIndexHtml" node_modules/vite-plugin-html-inject/dist`

Type guard

const usesTransformIndexHtml = (plugin) => typeof plugin?.transformIndexHtml === 'function' || typeof plugin?.transformIndexHtml === 'object';

Prevention

When it happens

Trigger: Adding a Vite plugin (e.g. certain HTML-injection, PWA, or meta-tag plugins) to vite.config that registers `transformIndexHtml` while using SvelteKit.

Common situations: Installing plugins from generic Vite ecosystems (e.g. html injectors, some template engines); following non-SvelteKit Vite setup guides.

Related errors


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