We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3b912fb commit 3a41bd8Copy full SHA for 3a41bd8
packages/vite/src/client/client.ts
@@ -363,6 +363,13 @@ function waitForWindowShow() {
363
}
364
365
const sheetsMap = new Map<string, HTMLStyleElement>()
366
+
367
+// collect existing style elements that may have been inserted during SSR
368
+// to avoid FOUC or duplicate styles
369
+document.querySelectorAll('style[data-vite-dev-id]').forEach((el) => {
370
+ sheetsMap.set(el.getAttribute('data-vite-dev-id')!, el as HTMLStyleElement)
371
+})
372
373
// all css imports should be inserted at the same position
374
// because after build it will be a single css file
375
let lastInsertedStyle: HTMLStyleElement | undefined
0 commit comments