Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: improve reload page in watch-files.mdx #3318

Merged
merged 3 commits into from
Aug 30, 2024
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
6 changes: 5 additions & 1 deletion website/docs/en/config/dev/watch-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ Specifies whether to trigger a page reload or restart the dev server when a file

### reload-page

`reload-page` means that the browser page will automatically reload when a file changes. This can be used to watch changes to static assets, such as files in the `public` directory.
`reload-page` means that when a file changes, the page opened in the browser will automatically reload. If the type is not explicitly specified, Rsbuild will default to the `reload-page` behavior.

This can be used to watch changes to static assets, such as files in the `public` directory.

```js
export default {
dev: {
watchFiles: {
type: 'reload-page',
paths: 'public/**/*',
},
},
Expand All @@ -94,6 +97,7 @@ export default {
...commonConfig,
dev: {
watchFiles: {
type: 'reload-server',
paths: ['./config/*.ts'],
},
},
Expand Down
6 changes: 5 additions & 1 deletion website/docs/zh/config/dev/watch-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ export default {

### reload-page

reload-page 表示当文件发生变化时,浏览器打开的页面会自动重新加载。这可以用于监听一些静态资源文件的变化,例如 `public` 目录下的文件。
reload-page 表示当文件发生变化时,浏览器打开的页面会自动重新加载。如果未明确指定 type,Rsbuild 会默认采用 reload-page 行为。

这可以用于监听一些静态资源文件的变化,例如 `public` 目录下的文件。

```js
export default {
dev: {
watchFiles: {
type: 'reload-page',
paths: 'public/**/*',
},
},
Expand All @@ -94,6 +97,7 @@ export default {
...commonConfig,
dev: {
watchFiles: {
type: 'reload-server',
paths: ['./config/*.ts'],
},
},
Expand Down
Loading