diff --git a/code/frameworks/vue3-vite/src/plugins/vue-component-meta.ts b/code/frameworks/vue3-vite/src/plugins/vue-component-meta.ts index 2ca7a0d106f6..f87f8b9792d5 100644 --- a/code/frameworks/vue3-vite/src/plugins/vue-component-meta.ts +++ b/code/frameworks/vue3-vite/src/plugins/vue-component-meta.ts @@ -3,7 +3,7 @@ import { dirname, join, parse, relative, resolve } from 'node:path'; import findPackageJson from 'find-package-json'; import MagicString from 'magic-string'; -import type { PluginOption } from 'vite'; +import type { ModuleNode, PluginOption } from 'vite'; import { type ComponentMeta, type MetaCheckerOptions, @@ -147,9 +147,18 @@ export async function vueComponentMeta(tsconfigPath = 'tsconfig.json'): Promise< } }, // handle hot updates to update the component meta on file changes - async handleHotUpdate({ file, read }) { + async handleHotUpdate({ file, read, server, modules, timestamp }) { const content = await read(); checker.updateFile(file, content); + // Invalidate modules manually + const invalidatedModules = new Set(); + + for (const mod of modules) { + server.moduleGraph.invalidateModule(mod, invalidatedModules, timestamp, true); + } + + server.ws.send({ type: 'full-reload' }); + return []; }, }; }