Skip to content

HMR not working when Cloudflare adapter set to prerenderEnvironment: 'node' #16141

@michaelroper

Description

@michaelroper

Astro Info

Astro                    v6.1.1
Vite                     v7.3.1
Node                     v24.14.1
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/cloudflare (v13.1.4)
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When the Cloudflare adapter is added to the site with its config set to { prerenderEnvironment: 'node' }, the HMR feature of the dev server will not hot-reload any changes made to any files, and the browser must be refreshed manually.

Vite still seems to be sending the reload command, but nothing happens in the browser.

 astro  v6.1.1 ready in 2954 ms
┃ Local    http://localhost:4321/
┃ Network  use --host to expose
14:13:17 watching for file changes...
14:13:22 [200] / 12ms
14:13:23 [200] / 1ms
14:13:27 [watch] src/pages/index.astro
[vite] program reload
14:13:28 [watch] src/pages/index.astro
[vite] program reload
14:13:29 [watch] src/pages/index.astro
[vite] program reload

What's the expected result?

When in astro dev mode, the browser content should automatically refresh when a file is saved in the editor.

Link to Minimal Reproducible Example

https://github.com/michaelroper/astro-v6-cf-prerender-node

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions