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
12 changes: 3 additions & 9 deletions website/docs/en/plugins/dev/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,25 @@ This chapter introduces the plugin hooks available for Rsbuild plugins.

### Dev hooks

Called only when running the `rsbuild dev` command or the `rsbuild.startDevServer()` method.
Called when running the `rsbuild dev` command or the `rsbuild.startDevServer()` method:

- [onBeforeStartDevServer](#onbeforestartdevserver): Called before starting the dev server.
- [onAfterStartDevServer](#onafterstartdevserver): Called after starting the dev server.
- [onBeforeDevCompile](#onbeforedevcompile): Called before each build in development mode.
- [onAfterDevCompile](#onafterdevcompile): Called after each build in development mode.

Called only when Rsbuild is restarted or when the [close()](/api/javascript-api/instance#close-server) method of `rsbuild.startDevServer()` is executed.

- [onCloseDevServer](#onclosedevserver): Called when the dev server is closed.

### Build hooks

Called only when running the `rsbuild build` command or the `rsbuild.build()` method.
Called when running the `rsbuild build` command or the `rsbuild.build()` method:

- [onBeforeBuild](#onbeforebuild): Called before running the production build.
- [onAfterBuild](#onafterbuild): Called after running the production build. You can get the build result information.

Called only when Rsbuild is restarted or when the [close()](/api/javascript-api/instance#close-build) method of `rsbuild.build()` is executed.

- [onCloseBuild](#onclosebuild): Called when the build is closed.

### Preview hooks

Called only when running the `rsbuild preview` command or the `rsbuild.preview()` method.
Called when running the `rsbuild preview` command or the `rsbuild.preview()` method:

- [onBeforeStartProdServer](#onbeforestartprodserver): Called before starting the production server.
- [onAfterStartProdServer](#onafterstartprodserver): Called after starting the production server.
Expand Down
12 changes: 3 additions & 9 deletions website/docs/zh/plugins/dev/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,25 @@

### Dev hooks

仅在执行 `rsbuild dev` 命令或 `rsbuild.startDevServer()` 方法时调用
在执行 `rsbuild dev` 命令或 `rsbuild.startDevServer()` 方法时调用

- [onBeforeStartDevServer](#onbeforestartdevserver):在启动开发服务器前调用。
- [onAfterStartDevServer](#onafterstartdevserver):在启动开发服务器后调用。
- [onBeforeDevCompile](#onbeforedevcompile):在每次执行开发环境构建前调用。
- [onAfterDevCompile](#onafterdevcompile):在每次开发模式构建结束后调用。

仅在 Rsbuild restart 时,或是执行 `rsbuild.startDevServer()` 的 [close()](/api/javascript-api/instance#关闭-server) 方法时调用。

- [onCloseDevServer](#onclosedevserver):在关闭开发服务器时调用。

### Build hooks

仅在执行 `rsbuild build` 命令或 `rsbuild.build()` 方法时调用
在执行 `rsbuild build` 命令或 `rsbuild.build()` 方法时调用

- [onBeforeBuild](#onbeforebuild):在执行生产模式构建前调用。
- [onAfterBuild](#onafterbuild):在执行生产模式构建后调用,可以获取到构建结果信息。

仅在 Rsbuild restart 时,或是执行 `rsbuild.build()` 的 [close()](/api/javascript-api/instance#结束构建) 方法时调用。

- [onCloseBuild](#onclosebuild):在关闭构建时调用。

### Preview hooks

仅在执行 `rsbuild preview` 命令或 `rsbuild.preview()` 方法时调用
在执行 `rsbuild preview` 命令或 `rsbuild.preview()` 方法时调用

- [onBeforeStartProdServer](#onbeforestartprodserver):在启动生产服务器前调用。
- [onAfterStartProdServer](#onafterstartprodserver):在启动生产服务器后调用。
Expand Down
Loading