Skip to content
Draft
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
16 changes: 8 additions & 8 deletions website/docs/en/config/dev/watch-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ type WatchFilesConfig = WatchFiles | WatchFiles[];

- **Default:** `undefined`

Watch specified files and directories for changes. When a file change is detected, it can trigger a page reload or restart the dev server.
Watch specified files and directories for changes. When a change is detected, it can trigger a page reload or restart the dev server.

## paths

- **Type:** `string | string[]`
- **Default:** `undefined`

Paths of the files or directories to be watched, supports glob syntax. It can be a single path or an array of multiple paths.
Paths of the files or directories to watch, supports glob syntax. It can be a single path or an array of multiple paths.

- Watching a single file:

Expand Down Expand Up @@ -69,7 +69,7 @@ Specifies whether to trigger a page reload or restart the dev server when a file

### reload-page

`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.
`reload-page` means that when a file changes, the page in the browser will automatically reload. If the type is not explicitly specified, Rsbuild defaults to the `reload-page` behavior.

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

Expand All @@ -88,9 +88,9 @@ export default {

### reload-server

`reload-server` means that the dev server will automatically restart when a file changes. This can be used to watch changes to configuration files, such as modules imported by the `rsbuild.config.ts` file.
`reload-server` means that the dev server will automatically restart when a file changes. This can be used to watch changes to configuration files, such as modules imported by your `rsbuild.config.ts` file.

For example, if you maintain some common configuration files in the `config` directory, such as `common.ts`, you want the dev server to automatically restart when these files change. Example configuration:
For example, if you maintain some common configuration files in the `config` directory, such as `common.ts`, you may want the dev server to automatically restart when these files change. Example configuration:

```ts title="rsbuild.config.ts"
import { commonConfig } from './config/common';
Expand All @@ -106,7 +106,7 @@ export default {
};
```

It should be noted that the reload-server functionality is provided by Rsbuild CLI. If you are using a custom server or an upper-layer framework based on the Rsbuild, this configuration is currently not supported.
Note that the reload-server functionality is provided by Rsbuild CLI. If you are using a custom server or a framework built on top of Rsbuild, this configuration is currently not supported.

## options

Expand All @@ -130,8 +130,8 @@ export default {

## Notes

`watchFiles` is not applicable for watching build dependency files. When an Rsbuild build starts, the underlying Rspack will automatically watches all build dependencies. Any changes to these files will trigger a new build.
`watchFiles` is not applicable for watching build dependency files. When an Rsbuild build starts, the underlying Rspack automatically watches all build dependencies. Any changes to these files will trigger a new build.

If you want to prevent some files from triggering a rebuild when they change, you can use Rspack's [watchOptions.ignored](https://rspack.rs/config/watch#watchoptionsignored) configuration item.

> See [HMR - File Watching](/guide/advanced/hmr#file-watching) for more details.
> See [HMR - File Watching](/guide/advanced/hmr#file-watching) for details.
8 changes: 4 additions & 4 deletions website/docs/en/config/server/open.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Open =

- **Default:** `undefined`

`server.open` is used to configure a set of page URLs that Rsbuild will automatically open in the browser after starting the server.
`server.open` configures which page URLs Rsbuild should automatically open in the browser after starting the server.

> You can also use the [--open](/guide/basic/cli#opening-page) option of Rsbuild CLI to open the pages. When using `server.open` and `--open` at the same time, `--open` takes precedence.

Expand Down Expand Up @@ -92,7 +92,7 @@ export default {

## Specify browser

Rsbuild opens pages in the system default browser by default, and supports specifying which browser to use when starting the dev server through the `BROWSER` environment variable.
By default, Rsbuild opens pages in the system's default browser. You can specify which browser to use via the `BROWSER` environment variable.

### Browser name

Expand All @@ -116,7 +116,7 @@ npm i cross-env -D
cross-env BROWSER=chrome npx rsbuild dev
```

You can also refer to the [app option](https://github.com/sindresorhus/open?tab=readme-ov-file#app) of `open` to configure more special `BROWSER` values, such as some OS-specific browser names:
You can also refer to the [app option](https://github.com/sindresorhus/open?tab=readme-ov-file#app) of `open` for additional `BROWSER` values, such as OS-specific browser names:

```bash
# macOS
Expand Down Expand Up @@ -157,7 +157,7 @@ BROWSER="Google Chrome Canary" npx rsbuild dev

### Configure environment variable

You can set the `BROWSER` environment variable in the local [.env.local](/guide/advanced/env-vars#env-file) file, so you do not need to manually set the environment variable every time you start the dev server, and it also avoids affecting other developers in the project.
You can set the `BROWSER` environment variable in your local [.env.local](/guide/advanced/env-vars#env-file) file. This eliminates the need to manually set it each time you start the dev server and prevents affecting other developers on the project.

```bash
# .env.local
Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/config/source/define.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- **Type:** `Record<string, unknown>`
- **Default:** `{}`

Replaces variables in your code with other values or expressions at compile time. This is useful for enabling different behavior between development and production builds.
Replaces variables in your code with other values or expressions at compile time. This enables different behavior between development and production builds.

Each configuration key represents an identifier or multiple identifiers joined with `.`:

Expand Down
Loading