Skip to content

Vite HMR bug when serving only HTML #7836

@leonsilicon

Description

@leonsilicon

Describe the bug

When using Vite with only an HTML file, changing the code creates an HMR request but this doesn't update the HTML.

This worked in vite@2.9.0-beta.0 but stopped working in vite@2.9.0-beta.1

Here's a repro showing the regression: https://github.com/leonzalion/vite-hmr-bug

And a video:

bug.mp4

Reproduction

https://stackblitz.com/edit/vitejs-vite-vmzqtg?file=index.html&terminal=dev

System Info

System:
    OS: macOS 11.6.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 37.89 GB / 64.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.8.0 - ~/Library/pnpm/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.5.5 - ~/Library/pnpm/npm
  Browsers:
    Brave Browser: 100.1.37.114
    Chrome: 100.0.4896.127
    Firefox: 99.0
    Safari: 15.3

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: hmrp2-edge-caseBug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions