Skip to content

Commit a453b62

Browse files
committed
fix(hmr): always use main module for vue sfc
1 parent 8d5a270 commit a453b62

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/plugin-vue/src/handleHotUpdate.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,15 @@ export function handleTypeDepChange(
348348
const affected = new Set<ModuleNode>()
349349
for (const file of affectedComponents) {
350350
invalidateScript(file)
351+
const useMainModule = file.endsWith('.vue')
351352
const mods = moduleGraph.getModulesByFile(file)
352353
if (mods) {
353354
const arr = [...mods]
354-
affected.add(getScriptModule(arr) || getMainModule(arr))
355+
affected.add(
356+
useMainModule
357+
? getMainModule(arr)
358+
: getScriptModule(arr) || getMainModule(arr),
359+
)
355360
}
356361
}
357362
return [...modules, ...affected]

0 commit comments

Comments
 (0)