-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Interaction with Vite transformIndexHtml plugin #12391
Copy link
Copy link
Open
Labels
feature / enhancementNew feature or requestNew feature or request
Milestone
Description
Describe the bug
I'm not sure if this is desired or not or a documentation thing.
For some reason Vite transformIndexHtml plugins do not run.
Reproduction
Just paste this inside a vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, type Plugin } from 'vite';
const htmlPlugin = () => {
console.log('plugin init');
return {
name: 'html-transform',
transformIndexHtml(html) {
console.log('plugin transform'); // Never runs
return html.replace(/<title>(.*?)<\/title>/, `<title>Title replaced!</title>`);
}
} satisfies Plugin;
};
export default defineConfig({
plugins: [htmlPlugin(), sveltekit()]
});Logs
No response
System Info
System:
OS: macOS 14.5
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 16.11 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
pnpm: 9.4.0 - ~/Library/pnpm/pnpm
Browsers:
Brave Browser: 126.1.67.119
Chrome: 126.0.6478.63
Safari: 17.5Severity
annoyance
Additional Information
Why is this happening?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature / enhancementNew feature or requestNew feature or request