fix: inject client entry on islands-free pages for HMR (#3810)

Fixes denoland/fresh#3806

---------

Co-authored-by: fibibot <fibibot@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
Fibi
2026-05-27 08:15:51 +02:00
committed by GitHub
co-authored by fibibot Bartek Iwańczuk
parent 1fcf2d9ad5
commit 072d09297e
4 changed files with 41 additions and 0 deletions
@@ -93,6 +93,23 @@ integrationTest("vite dev - starts without islands/ dir", async () => {
});
});
// Issue: https://github.com/denoland/fresh/issues/3806
// Pages without islands must still load the client entry in dev so the
// HMR `fresh:reload` listener attaches and route edits trigger a refresh.
integrationTest(
"vite dev - injects client entry on islands-free pages for HMR",
async () => {
const fixture = path.join(FIXTURE_DIR, "no_islands");
await withDevServer(fixture, async (address) => {
const res = await fetch(`${address}/`);
const text = await res.text();
expect(text).toContain("ok");
expect(text).toContain("/@id/fresh:client-entry");
expect(text).toMatch(/import\s*\{\s*boot\s*\}/);
});
},
);
integrationTest("vite dev - starts without routes/ dir", async () => {
const fixture = path.join(FIXTURE_DIR, "no_routes");
await withDevServer(fixture, async (address) => {