Skip to content

Commit 326e178

Browse files
fix(astro): terminal HMR path (close #8831) (#8863)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
1 parent 5c888c1 commit 326e178

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

.changeset/two-lamps-tell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Fixes an issue where the dev server logged the full file path on updates.

packages/astro/src/vite-plugin-astro/hmr.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { slash } from '@astrojs/internal-helpers/path';
12
import { fileURLToPath } from 'node:url';
23
import type { HmrContext, ModuleNode } from 'vite';
34
import type { AstroConfig } from '../@types/astro.js';
@@ -91,7 +92,7 @@ export async function handleHotUpdate(
9192
// Bugfix: sometimes style URLs get normalized and end with `lang.css=`
9293
// These will cause full reloads, so filter them out here
9394
const mods = [...filtered].filter((m) => !m.url.endsWith('='));
94-
const file = ctx.file.replace(config.root.pathname, '/');
95+
const file = ctx.file.replace(slash(fileURLToPath(config.root)), '/');
9596

9697
// If only styles are changed, remove the component file from the update list
9798
if (isStyleOnlyChange) {

0 commit comments

Comments
 (0)