summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/astro/e2e/css-sourcemaps.test.js4
-rw-r--r--packages/astro/e2e/css.test.js4
-rw-r--r--packages/astro/src/core/render/dev/index.ts2
-rw-r--r--packages/astro/src/runtime/client/hmr.ts6
4 files changed, 10 insertions, 6 deletions
diff --git a/packages/astro/e2e/css-sourcemaps.test.js b/packages/astro/e2e/css-sourcemaps.test.js
index 07cea4cb0..919d3c864 100644
--- a/packages/astro/e2e/css-sourcemaps.test.js
+++ b/packages/astro/e2e/css-sourcemaps.test.js
@@ -19,8 +19,8 @@ test.describe('CSS Sourcemap HMR', () => {
test.skip(isWindows, 'TODO: fix css hmr in windows');
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
- const html = await astro.fetch('/').then(res => res.text());
-
+ const html = await astro.fetch('/').then((res) => res.text());
+
// style[data-astro-dev-id] should exist in initial SSR'd markup
expect(html).toMatch('data-astro-dev-id');
diff --git a/packages/astro/e2e/css.test.js b/packages/astro/e2e/css.test.js
index 745a540ee..7c2527499 100644
--- a/packages/astro/e2e/css.test.js
+++ b/packages/astro/e2e/css.test.js
@@ -32,8 +32,8 @@ test.describe('CSS HMR', () => {
});
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
- const html = await astro.fetch('/').then(res => res.text());
-
+ const html = await astro.fetch('/').then((res) => res.text());
+
// style[data-astro-dev-id] should exist in initial SSR'd markup
expect(html).toMatch('data-astro-dev-id');
diff --git a/packages/astro/src/core/render/dev/index.ts b/packages/astro/src/core/render/dev/index.ts
index 7ea008d69..92d374d3e 100644
--- a/packages/astro/src/core/render/dev/index.ts
+++ b/packages/astro/src/core/render/dev/index.ts
@@ -136,7 +136,7 @@ async function getScriptsAndStyles({ env, filePath }: GetScriptsAndStylesParams)
props: {
type: 'text/css',
// Track the ID so we can match it to Vite's injected style later
- 'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root))
+ 'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root)),
},
children: content,
});
diff --git a/packages/astro/src/runtime/client/hmr.ts b/packages/astro/src/runtime/client/hmr.ts
index b71c39990..b4c6acb88 100644
--- a/packages/astro/src/runtime/client/hmr.ts
+++ b/packages/astro/src/runtime/client/hmr.ts
@@ -42,5 +42,9 @@ function isStyle(node: Node): node is HTMLStyleElement {
}
function isViteInjectedStyle(node: Node): node is HTMLStyleElement {
- return isStyle(node) && node.getAttribute('type') === 'text/css' && !!node.getAttribute('data-vite-dev-id');
+ return (
+ isStyle(node) &&
+ node.getAttribute('type') === 'text/css' &&
+ !!node.getAttribute('data-vite-dev-id')
+ );
}