Skip to content

Commit

Permalink
fix(hmr): always use main module for vue sfc
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Sep 19, 2024
1 parent 8d5a270 commit a453b62
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/plugin-vue/src/handleHotUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,15 @@ export function handleTypeDepChange(
const affected = new Set<ModuleNode>()
for (const file of affectedComponents) {
invalidateScript(file)
const useMainModule = file.endsWith('.vue')
const mods = moduleGraph.getModulesByFile(file)
if (mods) {
const arr = [...mods]
affected.add(getScriptModule(arr) || getMainModule(arr))
affected.add(
useMainModule
? getMainModule(arr)
: getScriptModule(arr) || getMainModule(arr),
)
}
}
return [...modules, ...affected]
Expand Down

0 comments on commit a453b62

Please sign in to comment.