From 6d011a5cf7d9d8340879d1d30283f03fc8b7b75a Mon Sep 17 00:00:00 2001 From: Daniel Leroux Date: Tue, 25 Feb 2025 06:57:02 +0100 Subject: [PATCH] fix(runtime): only hydrate styles on client side --- src/runtime/styles.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/styles.ts b/src/runtime/styles.ts index ae5b6ef834d..c142cd774ba 100644 --- a/src/runtime/styles.ts +++ b/src/runtime/styles.ts @@ -247,6 +247,9 @@ export const convertScopedToShadow = (css: string) => css.replace(/\/\*!@([^\/]+ * and add them to a constructable stylesheet. */ export const hydrateScopedToShadow = () => { + if (typeof window === 'undefined') { + return; + } const styles = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`); let i = 0; for (; i < styles.length; i++) {