Vite's "transformIndexHtml" hook is not invoked on build #3314
Open
Description
Describe the bug
When building the docs, transformIndexHtml
hook is not invoked.
The hook is invoked is dev mode, though.
Reproduction
- Open https://stackblitz.com/edit/vite-sqmglm?file=docs%2F.vitepress%2Fconfig.ts
- Notice
transformIndexHtml
hook which logs "HELLO" when invoked - Run
npm run docs:build
- Notice "HELLO" is not printed in the console
- Run
npm run docs:dev
- Notice "HELLO" is printed in the console
Expected behavior
transformIndexHtml
is invoked when building.
System Info
System:
OS: Windows 10 10.0.19045
CPU: (16) x64 Intel(R) Core(TM) i7-6900K CPU @ 3.20GHz
Memory: 44.41 GB / 63.92 GB
Binaries:
Node: 20.5.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.6.6 - C:\Program Files\nodejs\npm.CMD
pnpm: 7.29.3 - C:\ProgramData\chocolatey\bin\pnpm.EXE
Browsers:
Chrome: 119.0.6045.200
Edge: Spartan (44.19041.3636.0), Chromium (120.0.2210.61)
Additional context
Maybe related: #1380
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.