Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions guide/api-environment-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Vite 服务器有一个共享的插件管道,但在处理模块时,它总是
## `hotUpdate` 钩子 {#the-hotupdate-hook}

- **类型:** `(this: { environment: DevEnvironment }, options: HotUpdateOptions) => Array<EnvironmentModuleNode> | void | Promise<Array<EnvironmentModuleNode> | void>`
- **种类:** `async`, `sequential`
- **查看:** [HMR API](./api-hmr)

`hotUpdate` 钩子允许插件为特定环境执行自定义的 HMR 更新处理。当一个文件发生变化时,会按照 `server.environments` 中的顺序为每个环境依次运行 HMR 算法,因此 `hotUpdate` 钩子会被多次调用。这个钩子会接收一个带有以下签名的上下文对象:
Expand Down
1 change: 1 addition & 0 deletions guide/api-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ Vite 插件也可以提供钩子来服务于特定的 Vite 目标。这些钩子
### `handleHotUpdate` {#handlehotupdate}

- **类型:** `(ctx: HmrContext) => Array<ModuleNode> | void | Promise<Array<ModuleNode> | void>`
- **种类:** `async`, `sequential`
- **参见:** [HMR API](./api-hmr)

执行自定义 HMR 更新处理。钩子接收一个带有以下签名的上下文对象:
Expand Down