Skip to content

Commit 29a71f8

Browse files
authored
fix: patch handleHotUpdate properly (#2903)
While the current patch code works fine as `this` is `undefined` for current Vite, Vite 7+ will pass the context (vitejs/vite#19936) and the current code doesn't work anymore. This PR changes the code to call the hook function with the original `this`. This PR should fix the ecosystem-ci failure. https://github.com/vitejs/vite-ecosystem-ci/actions/runs/15291891294/job/43012757742#step:8:3335
1 parent 98e3b5f commit 29a71f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/vite/vite-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,8 @@ function replaceHandleHotUpdate(reader: Reader, plugins: vite.Plugin[]) {
613613
: plugin.handleHotUpdate.handler;
614614
return {
615615
...plugin,
616-
handleHotUpdate: async (ctx: vite.HmrContext) => {
617-
await handleHotUpdate({
616+
handleHotUpdate: async function (ctx: vite.HmrContext) {
617+
await handleHotUpdate.call(this, {
618618
...ctx,
619619
read: async () => {
620620
const entry = await reader.read(ctx.file);

0 commit comments

Comments
 (0)