diff --git a/docs/changes/hotupdate-hook.md b/docs/changes/hotupdate-hook.md index 9a660c2d18fdf1..ce3283f01d6f8f 100644 --- a/docs/changes/hotupdate-hook.md +++ b/docs/changes/hotupdate-hook.md @@ -28,10 +28,10 @@ interface HmrContext { This hook is called once for all environments, and the passed modules have mixed information from the Client and SSR environments only. Once frameworks move to custom environments, a new hook that is called for each of them is needed. -The new `hotUpdate` hook works in the same way as `handleHotUpdate` but it is called for each environment and receives a new `HotUpdateContext` instance: +The new `hotUpdate` hook works in the same way as `handleHotUpdate` but it is called for each environment and receives a new `HotUpdateOptions` instance: ```ts -interface HotUpdateContext { +interface HotUpdateOptions { type: 'create' | 'update' | 'delete' file: string timestamp: number diff --git a/docs/guide/api-environment-plugins.md b/docs/guide/api-environment-plugins.md index 151cf855d7d54e..2271d1e13fb2f7 100644 --- a/docs/guide/api-environment-plugins.md +++ b/docs/guide/api-environment-plugins.md @@ -58,7 +58,7 @@ Plugins should set default values using the `config` hook. To configure each env The `hotUpdate` hook allows plugins to perform custom HMR update handling for a given environment. When a file changes, the HMR algorithm is run for each environment in series according to the order in `server.environments`, so the `hotUpdate` hook will be called multiple times. The hook receives a context object with the following signature: ```ts -interface HotUpdateContext { +interface HotUpdateOptions { type: 'create' | 'update' | 'delete' file: string timestamp: number diff --git a/packages/vite/src/node/server/hmr.ts b/packages/vite/src/node/server/hmr.ts index 60db76c9361958..265775e5e40c0b 100644 --- a/packages/vite/src/node/server/hmr.ts +++ b/packages/vite/src/node/server/hmr.ts @@ -446,7 +446,7 @@ export async function handleHMRUpdate( const options = { ...contextMeta, modules: [...mods], - // later on hotUpdate will be called for each runtime with a new HotUpdateContext + // later on hotUpdate will be called for each runtime with a new HotUpdateOptions environment, } hotMap.set(environment, { options })