diff --git a/packages/vite-node/src/hmr/emitter.ts b/packages/vite-node/src/hmr/emitter.ts index ddd884aa977d..1c8ee08b5ad4 100644 --- a/packages/vite-node/src/hmr/emitter.ts +++ b/packages/vite-node/src/hmr/emitter.ts @@ -63,6 +63,15 @@ export function viteNodeHmrPlugin(): Plugin { _send(payload) emitter.emit('message', payload) } + // eslint-disable-next-line ts/ban-ts-comment + // @ts-ignore Vite 6 compat + const environments = server.environments + if (environments) { + environments.ssr.hot.send = function (payload: any) { + _send(payload) + emitter.emit('message', payload) + } + } }, } }