You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/api/javascript-api/instance.mdx
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ type Version = string;
41
41
42
42
### context.rootPath
43
43
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.
45
45
46
46
-**Type:**
47
47
@@ -172,7 +172,7 @@ type bundlerType = 'rspack' | 'webpack';
172
172
173
173
## rsbuild.build
174
174
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.
176
176
177
177
-**Type:**
178
178
@@ -299,7 +299,7 @@ await rsbuild.build({
299
299
300
300
## rsbuild.startDevServer
301
301
302
-
Start the local dev server. This method will:
302
+
Starts the local dev server. This method will:
303
303
304
304
1. Start a development server that serves your application.
305
305
2. Watch for file changes and trigger recompilation.
@@ -429,7 +429,7 @@ await server.listen();
429
429
430
430
## rsbuild.preview
431
431
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).
433
433
434
434
-**Type:**
435
435
@@ -510,7 +510,7 @@ await server.close();
510
510
511
511
## rsbuild.createCompiler
512
512
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).
Copy file name to clipboardExpand all lines: website/docs/en/config/html/meta.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ const defaultMeta = {
14
14
};
15
15
```
16
16
17
-
Configure the `<meta>`tag of the HTML.
17
+
Configures the `<meta>`tags of the HTML.
18
18
19
19
:::tip
20
20
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 {
147
147
148
148
## Remove default value
149
149
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.
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.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/emit-assets.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,13 @@
3
3
-**Type:**`boolean`
4
4
-**Default:**`true`
5
5
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.
7
7
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.
9
9
10
10
## Example
11
11
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.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/minify.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ type Minify =
17
17
18
18
Controls code minification in production mode and configures minimizer options.
19
19
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:
21
21
22
22
:::tip
23
23
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 {
38
38
```
39
39
40
40
:::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.
42
42
:::
43
43
44
44
## Options
@@ -162,14 +162,14 @@ export default {
162
162
```
163
163
164
164
:::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.
166
166
:::
167
167
168
168
## Switching minifier
169
169
170
170
### JS minifier
171
171
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.
173
173
174
174
For example, use [terser-webpack-plugin](https://github.com/terser/terser-webpack-plugin) to switch to Terser or esbuild.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/source-map.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ const defaultSourceMap = {
20
20
};
21
21
```
22
22
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.
24
24
25
25
:::tip What is a source map
26
26
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.
Copy file name to clipboardExpand all lines: website/docs/en/config/source/define.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6
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.
7
7
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 `.`.
9
9
10
10
- If the value is a string, it will be used as a code fragment.
11
11
- If the value is not a string, it will be stringified (including functions).
Copy file name to clipboardExpand all lines: website/docs/en/guide/basic/output-files.mdx
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
# Output files
2
2
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.
4
4
5
5
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).
6
6
7
7
## Default directory structure
8
8
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.
10
10
11
11
```bash
12
12
dist
@@ -38,7 +38,7 @@ In the filename, `[name]` represents the entry name for this file, such as `inde
38
38
39
39
## Development mode output
40
40
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.
42
42
43
43
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`:
44
44
@@ -80,7 +80,7 @@ dist
80
80
└── qux.[hash].mp4
81
81
```
82
82
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:
84
84
85
85
```ts
86
86
exportdefault {
@@ -116,7 +116,7 @@ dist
116
116
└── [name].js
117
117
```
118
118
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.
120
120
121
121
Modify the output path of Node.js files using the [environments](/config/environments) config.
122
122
@@ -144,7 +144,7 @@ export default {
144
144
145
145
## Flatten the directory
146
146
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.
Copy file name to clipboardExpand all lines: website/docs/en/guide/framework/react.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ To use SVGR, you also need to register the [SVGR plugin](/plugins/list/plugin-sv
48
48
49
49
Rsbuild uses React's official [Fast Refresh](https://npmjs.com/package/react-refresh) capability to perform component hot updates.
50
50
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.
52
52
53
53
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.
0 commit comments