Skip to content

Commit b38d946

Browse files
Copilotchenjiahan
andauthored
docs: Improve documentation authenticity and clarity (#6046)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: chenjiahan <[email protected]> Co-authored-by: neverland <[email protected]>
1 parent 45301fe commit b38d946

File tree

13 files changed

+40
-40
lines changed

13 files changed

+40
-40
lines changed

website/docs/en/api/javascript-api/instance.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type Version = string;
4141

4242
### context.rootPath
4343

44-
The root path of current build, corresponding to the `cwd` option of [createRsbuild](/api/javascript-api/core#creatersbuild) method.
44+
The root path of the current build, corresponding to the `cwd` option of the [createRsbuild](/api/javascript-api/core#creatersbuild) method.
4545

4646
- **Type:**
4747

@@ -172,7 +172,7 @@ type bundlerType = 'rspack' | 'webpack';
172172
173173
## rsbuild.build
174174

175-
Perform a production mode build. This method will generate optimized production bundles and emit them to the output directory.
175+
Performs a production mode build. This method generates optimized production bundles and emits them to the output directory.
176176

177177
- **Type:**
178178

@@ -299,7 +299,7 @@ await rsbuild.build({
299299

300300
## rsbuild.startDevServer
301301

302-
Start the local dev server. This method will:
302+
Starts the local dev server. This method will:
303303

304304
1. Start a development server that serves your application.
305305
2. Watch for file changes and trigger recompilation.
@@ -429,7 +429,7 @@ await server.listen();
429429

430430
## rsbuild.preview
431431

432-
Start a server to preview the production build locally. This method should be executed after [rsbuild.build](#rsbuildbuild).
432+
Starts a server to preview the production build locally. This method should be executed after [rsbuild.build](#rsbuildbuild).
433433

434434
- **Type:**
435435

@@ -510,7 +510,7 @@ await server.close();
510510

511511
## rsbuild.createCompiler
512512

513-
Create an Rspack [Compiler](https://rspack.rs/api/javascript-api/compiler) instance. If there are multiple [environments](/config/environments) for this build, the return value is [MultiCompiler](https://rspack.rs/api/javascript-api/compiler#multicompiler).
513+
Creates an Rspack [Compiler](https://rspack.rs/api/javascript-api/compiler) instance. If there are multiple [environments](/config/environments) for this build, the return value is [MultiCompiler](https://rspack.rs/api/javascript-api/compiler#multicompiler).
514514

515515
- **Type:**
516516

@@ -528,7 +528,7 @@ const compiler = await rsbuild.createCompiler();
528528
529529
## rsbuild.addPlugins
530530

531-
Register one or more Rsbuild plugins, which can be called multiple times.
531+
Registers one or more Rsbuild plugins, which can be called multiple times.
532532

533533
This method needs to be called before compiling. If it is called after compiling, it will not affect the compilation result.
534534

@@ -557,7 +557,7 @@ rsbuild.addPlugins([pluginFoo()], { environment: 'node' });
557557

558558
## rsbuild.getPlugins
559559

560-
Get all the Rsbuild plugins registered in the current Rsbuild instance.
560+
Gets all the Rsbuild plugins registered in the current Rsbuild instance.
561561

562562
- **Type:**
563563

@@ -687,7 +687,7 @@ console.log(buildConfigs);
687687

688688
## rsbuild.inspectConfig
689689

690-
Inspect and debug Rsbuild's internal configurations. It provides access to:
690+
Inspects and debugs Rsbuild's internal configurations. It provides access to:
691691

692692
- The resolved Rsbuild configuration
693693
- The environment-specific Rsbuild configurations

website/docs/en/config/html/meta.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const defaultMeta = {
1414
};
1515
```
1616

17-
Configure the `<meta>` tag of the HTML.
17+
Configures the `<meta>` tags of the HTML.
1818

1919
:::tip
2020
If the HTML template used in the current project already contains the charset or viewport meta tags, then the tags in the HTML template take precedence.
@@ -147,7 +147,7 @@ export default {
147147

148148
## Remove default value
149149

150-
Setting the `value` of the `meta` object to `false` and the meta tag will not be generated.
150+
Setting the `value` of the `meta` object to `false` means the meta tag will not be generated.
151151

152152
For example to remove the `viewport`:
153153

website/docs/en/config/html/mount-id.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- **Type:** `string`
44
- **Default:** `'root'`
55

6-
By default, the `root` element is included in the HTML template for component mounting, and the element id can be modified through `mountId`.
6+
By default, the `root` element is included in the HTML template for component mounting. The element id can be modified through `mountId`.
77

88
```html
99
<body>
@@ -46,4 +46,4 @@ ReactDOM.createRoot(domNode).render(<App />);
4646

4747
### Custom templates
4848

49-
If you customized the HTML template, please make sure that the template contains `<div id="<%= mountId %>"></div>`, otherwise the `mountId` config will not take effect.
49+
If you've customized the HTML template, please make sure that the template contains `<div id="<%= mountId %>"></div>`, otherwise the `mountId` config will not take effect.

website/docs/en/config/output/emit-assets.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
- **Type:** `boolean`
44
- **Default:** `true`
55

6-
Control whether to emit static assets such as images, fonts, audio, video, etc.
6+
Controls whether to emit static assets such as images, fonts, audio, video, etc.
77

8-
In scenarios such as SSR, you may not need to emit duplicate static assets. Therefore, you can return `false` in `emitAssets` to avoid emitting assets.
8+
In scenarios such as SSR, you may not need to emit duplicate static assets. Therefore, you can set `emitAssets` to `false` to avoid emitting assets.
99

1010
## Example
1111

12-
For example, the following example will emit static assets when building web bundles, and avoid emitting when building node bundles.
12+
The following example will emit static assets when building web bundles, and avoid emitting when building node bundles.
1313

1414
```js
1515
export default {

website/docs/en/config/output/legal-comments.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- **Type:** `'linked' | 'inline' | 'none'`
44
- **Default:** `'linked'`
55

6-
Configure how to handle legal comments.
6+
Controls how legal comments are handled in the build output.
77

88
## What are legal comments?
99

@@ -25,11 +25,11 @@ For example, the `LICENSE` comment in React:
2525

2626
## Optional values
2727

28-
You can configure how to handle legal comments using these options:
28+
You can control how legal comments are handled using these options:
2929

3030
### `linked`
3131

32-
Extract all legal comments to `*.LICENSE.txt` files and link to them with a comment.
32+
Extracts all legal comments to `*.LICENSE.txt` files and links to them with a comment.
3333

3434
```js title="rsbuild.config.js"
3535
export default {
@@ -43,7 +43,7 @@ export default {
4343

4444
### `inline`
4545

46-
Preserve all legal comments in the original position. This may increase the size of the output bundles.
46+
Preserves all legal comments in their original position. This may increase the size of the output bundles.
4747

4848
```js title="rsbuild.config.js"
4949
export default {
@@ -55,7 +55,7 @@ export default {
5555

5656
### `none`
5757

58-
Remove all legal comments.
58+
Removes all legal comments.
5959

6060
```js title="rsbuild.config.js"
6161
export default {

website/docs/en/config/output/minify.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type Minify =
1717

1818
Controls code minification in production mode and configures minimizer options.
1919

20-
By default, JS and CSS code are automatically minified in production mode to improve page performance. To disable minification for all code, set `minify` to `false`. Alternatively, control code minification behavior through detailed configuration of the `minify` option:
20+
By default, JS and CSS code are automatically minified in production mode to improve page performance. To disable minification entirely, set `minify` to `false`. You can also control specific minification behavior through the detailed `minify` options:
2121

2222
:::tip
2323
Rsbuild uses [SWC](/guide/configuration/swc) to minify JS code and [Lightning CSS](/guide/styling/css-usage#lightning-css) to minify CSS code by default.
@@ -38,7 +38,7 @@ export default {
3838
```
3939

4040
:::tip
41-
This approach is used for debugging and troubleshooting. We do not recommend to disable code minification in production builds, as it will significantly degrade page performance.
41+
This is useful for debugging and troubleshooting. We do not recommend disabling code minification in production builds, as it will significantly degrade page performance.
4242
:::
4343

4444
## Options
@@ -162,14 +162,14 @@ export default {
162162
```
163163

164164
:::tip
165-
When you configure some options in [tools.lightningcssLoader](/config/tools/lightningcss-loader), `output.minify.cssOptions` will automatically inherit these options, which ensures that the CSS code transformation behavior in the development build is consistent with that in the production build.
165+
When you configure options in [tools.lightningcssLoader](/config/tools/lightningcss-loader), `output.minify.cssOptions` will automatically inherit these options, ensuring that CSS code transformation behavior in the development build is consistent with the production build.
166166
:::
167167

168168
## Switching minifier
169169

170170
### JS minifier
171171

172-
If the default SWC minifier does not meet your needs, you can switch to other minifiers through the [tools.bundlerChain](/config/tools/bundler-chain) option.
172+
If the default SWC minifier doesn't meet your needs, you can switch to other minifiers using the [tools.bundlerChain](/config/tools/bundler-chain) option.
173173

174174
For example, use [terser-webpack-plugin](https://github.com/terser/terser-webpack-plugin) to switch to Terser or esbuild.
175175

website/docs/en/config/output/source-map.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const defaultSourceMap = {
2020
};
2121
```
2222

23-
Configure whether to generate source map files and which source map format to generate.
23+
Configures whether to generate source map files and which source map format to generate.
2424

2525
:::tip What is a source map
2626
Source map is an information file that stores the source code mapping relationship. It records each location of the compiled code and the corresponding pre-compilation location. With source map, you can directly view the source code when debugging compiled code.

website/docs/en/config/source/define.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
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.
77

8-
Each key passed into the configuration is an identifier or multiple identifiers joined with `.`.
8+
Each key passed to the configuration represents an identifier or multiple identifiers joined with `.`.
99

1010
- If the value is a string, it will be used as a code fragment.
1111
- If the value is not a string, it will be stringified (including functions).

website/docs/en/guide/basic/output-files.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Output files
22

3-
This section introduces the output file directory structure and how to control the output directory for different file types.
3+
This section introduces the output file directory structure and explains how to control the output directory for different file types.
44

55
If you want to know how to deploy the build outputs of Rsbuild as a static site, please refer to [Deploy Static Site](/guide/basic/static-deploy).
66

77
## Default directory structure
88

9-
The default output directory structure is shown below. Output files are written to the `dist` directory of the current project.
9+
The default output directory structure is shown below. Output files are written to the `dist` directory in the current project.
1010

1111
```bash
1212
dist
@@ -38,7 +38,7 @@ In the filename, `[name]` represents the entry name for this file, such as `inde
3838

3939
## Development mode output
4040

41-
In development mode, Rsbuild stores build outputs in memory on the dev server by default, rather than writing them to disk. This reduces filesystem operation overhead. Refer to [View Static Assets](/guide/basic/server#view-static-assets) to view all static assets generated in the current build.
41+
In development mode, Rsbuild stores build outputs in memory on the dev server by default, rather than writing them to disk. This reduces filesystem operation overhead. Refer to [View Static Assets](/guide/basic/server#view-static-assets) to see all static assets generated in the current build.
4242

4343
To write output files to disk (typically used for inspecting build artifacts or configuring proxy rules for static assets), set the [dev.writeToDisk](/config/dev/write-to-disk) configuration to `true`:
4444

@@ -80,7 +80,7 @@ dist
8080
└── qux.[hash].mp4
8181
```
8282

83-
Use the [output.distPath](/config/output/dist-path) config to write these static assets to a single directory, for example, to the `assets` directory:
83+
Use the [output.distPath](/config/output/dist-path) config to write these static assets to a single directory. For example, to organize them in an `assets` directory:
8484

8585
```ts
8686
export default {
@@ -116,7 +116,7 @@ dist
116116
└── [name].js
117117
```
118118

119-
Node.js outputs typically contain only JS files, without HTML or CSS. The JS file names do not include hash values.
119+
Node.js outputs typically contain only JS files, without HTML or CSS. The JS filenames do not include hash values.
120120

121121
Modify the output path of Node.js files using the [environments](/config/environments) config.
122122

@@ -144,7 +144,7 @@ export default {
144144

145145
## Flatten the directory
146146

147-
For a flatter directory structure in the dist directory, set the directory to an empty string to flatten the generated directory.
147+
For a flatter directory structure, set any directory to an empty string to flatten the generated output structure.
148148

149149
Here's an example:
150150

website/docs/en/guide/framework/react.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ To use SVGR, you also need to register the [SVGR plugin](/plugins/list/plugin-sv
4848

4949
Rsbuild uses React's official [Fast Refresh](https://npmjs.com/package/react-refresh) capability to perform component hot updates.
5050

51-
Note that React Refresh requires components to be written according to the standards. Otherwise HMR may not work. You can use [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) for validation.
51+
Note that React Refresh requires components to be written according to the standards, otherwise HMR may not work. You can use [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) for validation.
5252

5353
For example, if the hot update of the React component cannot take effect, or the state of the React component is lost after the hot update, it is usually because your React component uses an anonymous function. In the official practice of React Fast Refresh, it is required that the component cannot be an anonymous function, otherwise the state of the React component cannot be preserved after hot update.
5454

0 commit comments

Comments
 (0)