Skip to content

Vite's "transformIndexHtml" hook is not invoked on build #3314

Open
@elringus

Description

Describe the bug

When building the docs, transformIndexHtml hook is not invoked.

The hook is invoked is dev mode, though.

Reproduction

  1. Open https://stackblitz.com/edit/vite-sqmglm?file=docs%2F.vitepress%2Fconfig.ts
  2. Notice transformIndexHtml hook which logs "HELLO" when invoked
  3. Run npm run docs:build
  4. Notice "HELLO" is not printed in the console
  5. Run npm run docs:dev
  6. Notice "HELLO" is printed in the console

74a816b8b310188762685e6ffd91d64a

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

Metadata

Assignees

No one assigned

    Labels

    buildRelated to the build systemstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions