diff --git a/packages/vite/src/node/server/environments/rolldown.ts b/packages/vite/src/node/server/environments/rolldown.ts index 9ab06e1163656e..6a63ecb87eae81 100644 --- a/packages/vite/src/node/server/environments/rolldown.ts +++ b/packages/vite/src/node/server/environments/rolldown.ts @@ -331,6 +331,12 @@ class RolldownEnvironment extends DevEnvironment { if (!this.fileModuleIds.has(ctx.file)) { return } + for (const plugin of this.plugins) { + // TODO: for now, simple hack for vue hmr + if (plugin.name === 'vite:vue') { + ;(plugin.handleHotUpdate as any)(ctx) + } + } if ( this.rolldownDevOptions.hmr || this.rolldownDevOptions.ssrModuleRunner diff --git a/playground/rolldown-dev-vue/__tests__/basic.spec.ts b/playground/rolldown-dev-vue/__tests__/basic.spec.ts index 7a47a7182ace0b..26c56f3178c7e2 100644 --- a/playground/rolldown-dev-vue/__tests__/basic.spec.ts +++ b/playground/rolldown-dev-vue/__tests__/basic.spec.ts @@ -13,6 +13,6 @@ test.runIf(!isBuild)('hmr js', async () => { editFile('./src/App.vue', (s) => s.replace('Count:', 'Count-x:')) await page.getByRole('button', { name: 'Count-x: 1' }).click() - editFile('./src/app.tsx', (s) => s.replace('Count-x:', 'Count:')) + editFile('./src/App.vue', (s) => s.replace('Count-x:', 'Count:')) await page.getByRole('button', { name: 'Count: 2' }).click() })