{"record":{"id":"3b1926bab38f11d2","repo":"sveltejs/kit","slug":"the-following-plugins-may-not-work-correctly-becau","errorCode":null,"errorMessage":"The following plugins may not work correctly because they use the `transformIndexHtml` hook which is not supported:\n\n${list}","messagePattern":"The following plugins may not work correctly because they use the `transformIndexHtml` hook which is not supported:\n\n(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/exports/vite/index.js","lineNumber":585,"sourceCode":"\t\t/**\n\t\t * Stores the final config.\n\t\t */\n\t\tconfigResolved(config) {\n\t\t\tif (!is_build) {\n\t\t\t\t// Dependency scanning starts before configureServer creates the full manifest\n\t\t\t\twrite_app_manifest(`${out_dir}/generated/dev`, undefined, false);\n\t\t\t}\n\n\t\t\tconst unsupported_plugins = config.plugins.filter((plugin) => plugin.transformIndexHtml);\n\t\t\tif (unsupported_plugins.length) {\n\t\t\t\tconst verbose = config.logLevel === 'info' || config.logLevel === undefined;\n\t\t\t\tconst log = logger({ verbose });\n\n\t\t\t\tconst list = unsupported_plugins\n\t\t\t\t\t.map((plugin) => `  - ${plugin.name || '(missing plugin name)'}`)\n\t\t\t\t\t.join('\\n');\n\n\t\t\t\tlog.warn(\n\t\t\t\t\tdedent`\n\t\t\t\t\t\tThe following plugins may not work correctly because they use the \\`transformIndexHtml\\` hook which is not supported:\n\n\t\t\t\t\t\t${list}\n\t\t\t\t\t`\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Adds the SvelteKit middleware to do SSR in dev mode.\n\t\t * @see https://vitejs.dev/guide/api-plugin.html#configureserver\n\t\t */\n\t\tasync configureServer(server) {\n\t\t\treturn await dev(\n\t\t\t\tvite,\n\t\t\t\tserver,\n\t\t\t\tsvelte_config,","sourceCodeStart":567,"sourceCodeEnd":603,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/exports/vite/index.js#L567-L603","documentation":"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.","triggerScenarios":"Adding a Vite plugin (e.g. certain HTML-injection, PWA, or meta-tag plugins) to vite.config that registers `transformIndexHtml` while using SvelteKit.","commonSituations":"Installing plugins from generic Vite ecosystems (e.g. html injectors, some template engines); following non-SvelteKit Vite setup guides.","solutions":["Remove the plugin or find a SvelteKit-native alternative (e.g. use `%sveltekit.head%` / app.html or a `handle` hook)","If the plugin's feature is needed, implement it in src/hooks.server.js by transforming HTML in the `handle` hook","Check if the plugin offers a SvelteKit-compatible mode or newer version without transformIndexHtml"],"exampleFix":"// before (vite.config.js)\nplugins: [sveltekit(), htmlInjectPlugin()]\n// after\nplugins: [sveltekit()] // move injection logic into app.html or a handle hook","handlingStrategy":"validation","validationCode":"// audit plugins for unsupported hooks before configuring\nimport { readFileSync } from 'node:fs';\nconst pluginsDir = 'node_modules';\n// simpler: grep your vite.config plugin packages for transformIndexHtml in their dist\n// e.g. `grep -r \"transformIndexHtml\" node_modules/vite-plugin-html-inject/dist`","typeGuard":"const usesTransformIndexHtml = (plugin) => typeof plugin?.transformIndexHtml === 'function' || typeof plugin?.transformIndexHtml === 'object';","tryCatchPattern":null,"preventionTips":["Verify plugins are SvelteKit-compatible before adding them","Favor app.html + %sveltekit.head% / handle-hook solutions over HTML-transform plugins","Re-audit vite.config plugins on every SvelteKit major upgrade"],"tags":["vite","plugins","compatibility"],"backgroundTag":"unsupported-vite-plugin-hook","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}