summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Florian Lefebvre <contact@florian-lefebvre.dev> 2023-10-20 12:01:54 +0200
committerGravatar GitHub <noreply@github.com> 2023-10-20 11:01:54 +0100
commit326e178933f7a22f4e897b763832619f168b53dd (patch)
treebe6de19de536be72c8f467e8c2bb1806d214e643
parent5c888c10b712ca60a23e66b88af8051b54b42323 (diff)
downloadastro-326e178933f7a22f4e897b763832619f168b53dd.tar.gz
astro-326e178933f7a22f4e897b763832619f168b53dd.tar.zst
astro-326e178933f7a22f4e897b763832619f168b53dd.zip
fix(astro): terminal HMR path (close #8831) (#8863)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to '')
-rw-r--r--.changeset/two-lamps-tell.md5
-rw-r--r--packages/astro/src/vite-plugin-astro/hmr.ts3
2 files changed, 7 insertions, 1 deletions
diff --git a/.changeset/two-lamps-tell.md b/.changeset/two-lamps-tell.md
new file mode 100644
index 000000000..c79d1764b
--- /dev/null
+++ b/.changeset/two-lamps-tell.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes an issue where the dev server logged the full file path on updates.
diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts
index 6600b2f42..27cc2d10f 100644
--- a/packages/astro/src/vite-plugin-astro/hmr.ts
+++ b/packages/astro/src/vite-plugin-astro/hmr.ts
@@ -1,3 +1,4 @@
+import { slash } from '@astrojs/internal-helpers/path';
import { fileURLToPath } from 'node:url';
import type { HmrContext, ModuleNode } from 'vite';
import type { AstroConfig } from '../@types/astro.js';
@@ -91,7 +92,7 @@ export async function handleHotUpdate(
// Bugfix: sometimes style URLs get normalized and end with `lang.css=`
// These will cause full reloads, so filter them out here
const mods = [...filtered].filter((m) => !m.url.endsWith('='));
- const file = ctx.file.replace(config.root.pathname, '/');
+ const file = ctx.file.replace(slash(fileURLToPath(config.root)), '/');
// If only styles are changed, remove the component file from the update list
if (isStyleOnlyChange) {