Skip to content

Commit 16aa887

Browse files
authored
fix(plugin-vue): exclude direct css request from hmr target (#5422)
1 parent df59ff9 commit 16aa887

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/plugin-vue/src/handleHotUpdate.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { ResolvedOptions } from '.'
1111

1212
const debug = _debug('vite:hmr')
1313

14+
const directRequestRE = /(\?|&)direct\b/
15+
1416
/**
1517
* Vite-specific HMR handling
1618
*/
@@ -92,7 +94,8 @@ export async function handleHotUpdate(
9294
const mod = modules.find(
9395
(m) =>
9496
m.url.includes(`type=style&index=${i}`) &&
95-
m.url.endsWith(`.${next.lang || 'css'}`)
97+
m.url.endsWith(`.${next.lang || 'css'}`) &&
98+
!directRequestRE.test(m.url)
9699
)
97100
if (mod) {
98101
affectedModules.add(mod)

0 commit comments

Comments
 (0)