Skip to content

Inconsistent HMR with Cloudflare Vite Plugin in larger projects. #9963

Open
@Phoenixmatrix

Description

@Phoenixmatrix

What versions & operating system are you using?

[email protected], Node v20.10.0, Ubuntu 24, Vite 6/7 (tried multiple versions), React Router 7

Please provide a link to a minimal reproduction

No response

Describe the Bug

This is hard to give a minimal reproduction because I can only reproduce it in very large projects., so I'll try to describe the problem and happy to discuss what I can realistically provide.

We were using the Remix/RR7 cloudflare proxy plugin and just switched to the Cloudflare Vite Plugin 1.8.0 to work with Durable Objects.

The application itself works, but HMR no longer does. Or rather, it's now very inconsistent. I can see in the terminal the console logs that are expected when HMR triggers, I can see the network requests and assets in the browser console that are fetched because of HMR. The page flicker a little like it usually does in a big/slow app during an HMR update (more visible in Vite 6 than 7).

The actual update though, only happens like 1 out of 5 times. If I mash the save button in my IDE, the update will eventually happen in the browser. If I just save once, its a toss up if it will or not.

It might be similar to or related #9518 but that issue focuses on a bug caused by HMR, while I can't get HMR itself to work properly.

if I use a small project like the basic RR7 Cloudflare template, then it works perfectly. I expect that the build time has something to do with it.

Please provide any relevant error logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't working

    Type

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions