We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd86375 commit 08c1452Copy full SHA for 08c1452
packages/vite/src/client/client.ts
@@ -365,9 +365,11 @@ const sheetsMap = new Map<string, HTMLStyleElement>()
365
366
// collect existing style elements that may have been inserted during SSR
367
// to avoid FOUC or duplicate styles
368
-document.querySelectorAll('style[data-vite-dev-id]').forEach((el) => {
369
- sheetsMap.set(el.getAttribute('data-vite-dev-id')!, el as HTMLStyleElement)
370
-})
+if ('document' in globalThis) {
+ document.querySelectorAll('style[data-vite-dev-id]').forEach((el) => {
+ sheetsMap.set(el.getAttribute('data-vite-dev-id')!, el as HTMLStyleElement)
371
+ })
372
+}
373
374
// all css imports should be inserted at the same position
375
// because after build it will be a single css file
0 commit comments