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/start/index.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# JavaScript API
2
2
3
-
Rsbuild provides a complete set of JavaScript APIs for developers to build higherlevel tools or frameworks on top of Rsbuild.
3
+
Rsbuild provides a comprehensive JavaScript API for developers to build higher-level tools or frameworks on top of Rsbuild.
4
4
5
5
Rsbuild's JavaScript API can be used in Node.js, Deno, or Bun.
6
6
@@ -30,30 +30,30 @@ The `createRsbuild` method provides some options, which you can learn more about
30
30
31
31
### 3. Call Rsbuild instance method
32
32
33
-
The Rsbuild instance provides some methods, which you can use according to the usage scenarios.
33
+
The Rsbuild instance provides several methods that you can use according to your scenario.
34
34
35
-
To start local development, it is recommended to use the [rsbuild.startDevServer](/api/javascript-api/instance#rsbuildstartdevserver) method, which will start a local dev server.
35
+
For local development, we recommend using the [rsbuild.startDevServer](/api/javascript-api/instance#rsbuildstartdevserver) method, which starts a local dev server.
36
36
37
37
```ts
38
38
awaitrsbuild.startDevServer();
39
39
```
40
40
41
-
After successfully starting dev server, you can see the following logs:
41
+
After successfully starting the dev server, you will see the following logs:
42
42
43
43
```
44
44
➜ Local: http://localhost:3000
45
45
➜ Network: http://192.168.0.1:3000
46
46
```
47
47
48
-
To deploy the App to production environment, it is recommended to use the [rsbuild.build](/api/javascript-api/instance#rsbuildbuild) method, which will build the production outputs.
48
+
For production deployment, we recommend using the [rsbuild.build](/api/javascript-api/instance#rsbuildbuild) method, which builds the production outputs.
49
49
50
50
```ts
51
51
awaitrsbuild.build();
52
52
```
53
53
54
54
> For more introduction of Rsbuild instance methods, please read the [Rsbuild Instance](/api/javascript-api/instance) chapter.
55
55
56
-
After completing the above three steps, you have learned the basic usage of Rsbuild. Next, you can customize the build process through Rsbuild plugins and configurations.
56
+
After completing these three steps, you have learned the basic usage of Rsbuild. Next, you can customize the build process through Rsbuild plugins and configurations.
57
57
58
58
## Exports format
59
59
@@ -67,4 +67,4 @@ import { createRsbuild } from '@rsbuild/core';
Copy file name to clipboardExpand all lines: website/docs/en/config/environments.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
@@ -133,7 +133,7 @@ const nodeConfig = {
133
133
134
134
## Environment name
135
135
136
-
Since environment names are used for directory names and object property names, it is recommended to only include letters, numbers, `-`, `_`, and `$`. When using other characters, Rsbuild will output a warning to prompt you.
136
+
Since environment names are used for directory names and object property names, we recommend using only letters, numbers, `-`, `_`, and `$`. When using other characters, Rsbuild will display a warning.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/asset-prefix.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
@@ -5,9 +5,9 @@
5
5
6
6
In [production mode](/config/mode), use this option to set the URL prefix for static assets, such as setting it to a CDN URL.
7
7
8
-
`assetPrefix`will affect the URLs of most of the static assets, including JavaScript files, CSS files, images, videos, etc. If an incorrect value is specified, you'll receive 404 errors while loading these resources.
8
+
`assetPrefix`affects the URLs of most static assets, including JavaScript files, CSS files, images, videos, etc. If an incorrect value is specified, you'll receive 404 errors while loading these resources.
9
9
10
-
This config is only used in `production` mode or `none` mode. In `development` mode, use the [dev.assetPrefix](/config/dev/asset-prefix) to set the URL prefix.
10
+
This configuration is only used in `production` mode or `none` mode. In `development` mode, use the [dev.assetPrefix](/config/dev/asset-prefix) to set the URL prefix.
Whether to clean up all files in the output directory before the build starts. The output directory is the [output.distPath.root](/config/output/dist-path) directory.
11
+
Configure whether to clean up all files in the output directory before the build starts. The output directory is the [output.distPath.root](/config/output/dist-path) directory.
12
12
13
13
## Default behavior
14
14
15
15
The default value of `output.cleanDistPath` is `'auto'`:
16
16
17
17
- In development mode, if [dev.writeToDisk](/config/dev/write-to-disk) is `false`, Rsbuild will not perform cleanup.
18
-
- In any mode, if [output.distPath.root](/config/output/dist-path) is an external directory or equals to the project root directory, Rsbuild will not perform cleanup to avoid accidentally deleting files from other directories.
18
+
- In any mode, if [output.distPath.root](/config/output/dist-path) is an external directory or equals the project root directory, Rsbuild will not perform cleanup to avoid accidentally deleting files from other directories.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/css-modules.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
@@ -2,13 +2,13 @@
2
2
3
3
-**Type:**`CSSModules`
4
4
5
-
For custom CSS Modules configuration.
5
+
Configure custom CSS Modules settings.
6
6
7
-
The CSS Modules feature of Rsbuild is based on the `modules` option of css-loader. You can refer to [css-loader - modules](https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#modules) to learn more.
7
+
The CSS Modules feature in Rsbuild is based on the `modules` option of css-loader. You can refer to [css-loader - modules](https://github.com/webpack-contrib/css-loader?tab=readme-ov-file#modules) to learn more.
8
8
9
9
## cssModules.auto
10
10
11
-
The `auto` configuration option allows CSS Modules to be automatically enabled based on their filenames.
11
+
The `auto` configuration option allows CSS Modules to be automatically enabled based on filenames.
12
12
13
13
-**Type:**
14
14
@@ -27,7 +27,7 @@ type Auto =
27
27
28
28
Type description:
29
29
30
-
-`true`: enable CSS Modules for all files matching `/\.module\.\w+$/i.test(filename)` regexp.
30
+
-`true`: enable CSS Modules for all files matching the `/\.module\.\w+$/i.test(filename)` regexp.
31
31
-`false`: disable CSS Modules.
32
32
-`RegExp`: enable CSS Modules for all files matching `/RegExp/i.test(filename)` regexp.
33
33
-`function`: enable CSS Modules for files based on the filename satisfying your filter function check.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/dist-path.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,23 +40,23 @@ const defaultDistPath = {
40
40
};
41
41
```
42
42
43
-
Set the directory of the output files. Rsbuild will emit files to the specified subdirectory according to the file type.
43
+
Configure the directory for output files. Rsbuild will emit files to the specified subdirectory according to the file type.
44
44
45
45
> See [Output files](/guide/basic/output-files) for more information.
46
46
47
47
## File types
48
48
49
-
`output.distPath` can be set differently for different file types.
49
+
`output.distPath` can be configured differently for different file types.
50
50
51
51
Here are the details of each `output.distPath` option:
52
52
53
53
-`root`: The root directory of all output files.
54
54
-`html`: The output directory of HTML files.
55
55
-`favicon`: The output directory of favicon files.
56
56
-`js`: The output directory of JavaScript files.
57
-
-`jsAsync`: The output directory of async JavaScript files, which by default will be output to the `async` subdirectory of `distPath.js`.
57
+
-`jsAsync`: The output directory of async JavaScript files, which by default are output to the `async` subdirectory of `distPath.js`.
58
58
-`css`: The output directory of CSS style files.
59
-
-`cssAsync`: The output directory of async CSS files, which by default will be output to the `async` subdirectory of `distPath.css`.
59
+
-`cssAsync`: The output directory of async CSS files, which by default are output to the `async` subdirectory of `distPath.css`.
60
60
-`svg`: The output directory of SVG images.
61
61
-`font`: The output directory of font files.
62
62
-`wasm`: The output directory of WebAssembly files.
@@ -66,7 +66,7 @@ Here are the details of each `output.distPath` option:
66
66
67
67
## Root directory
68
68
69
-
The `root` is the root directory of the build artifacts and can be specified as a relative or absolute path. If `root` is a relative path, it will be appended to the project's root directory to form an absolute path.
69
+
The `root` is the root directory of the build artifacts and can be specified as a relative or absolute path. If `root` is a relative path, it is appended to the project's root directory to form an absolute path.
70
70
71
71
Other directories can only be specified as relative paths and will be output relative to the `root` directory.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/legal-comments.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
@@ -3,11 +3,11 @@
3
3
-**Type:**`'linked' | 'inline' | 'none'`
4
4
-**Default:**`'linked'`
5
5
6
-
Configure how to handle the legal comments.
6
+
Configure how to handle legal comments.
7
7
8
8
## What are legal comments?
9
9
10
-
A "legal comment" is considered to be any statement-level comment in JS or rule-level comment in CSS that contains @license or @preserve or that starts with //! or /\*!. These comments are preserved in output files by default since that follows the intent of the original authors of the code.
10
+
A "legal comment" is any statement-level comment in JS or rule-level comment in CSS that contains @license or @preserve, or that starts with //! or /\*!. These comments are preserved in output files by default since that follows the intent of the original authors of the code.
Copy file name to clipboardExpand all lines: website/docs/en/config/output/manifest.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
@@ -10,7 +10,7 @@ Configure how to generate the manifest file.
10
10
-`string`: Generate a manifest file with the specified filename or path.
11
11
-`object`: Generate a manifest file with the specified options.
12
12
13
-
The manifest file contains the information of all assets, and the mapping relationship between [entry module](/config/source/entry) and assets.
13
+
The manifest file contains information about all assets and the mapping between [entry modules](/config/source/entry) and assets.
14
14
15
15
## Basic example
16
16
@@ -49,7 +49,7 @@ After building, Rsbuild will generate a `dist/manifest.json` file:
49
49
50
50
## Manifest structure
51
51
52
-
By default, the manifest file will be output in the following structure:
52
+
The manifest file will be output with the following structure by default:
53
53
54
54
```ts
55
55
typeFilePath=string;
@@ -255,7 +255,7 @@ export default {
255
255
256
256
## Multiple environments
257
257
258
-
When using [environments](/config/environments)and configuring multiple environments, please specify a unique `manifest.filename` value for each environment to prevent manifest files from different environments from overwriting each other.
258
+
When using [environments](/config/environments)with multiple environments, please specify a unique `manifest.filename` value for each environment to prevent manifest files from different environments from overwriting each other.
259
259
260
260
For example, use the default `manifest.json` for the `web` environment and use `manifest-node.json` for the `node` environment:
261
261
@@ -279,7 +279,7 @@ export default {
279
279
};
280
280
```
281
281
282
-
You can also choose to generate the manifest file for a specific environment:
282
+
You can also choose to generate the manifest file only for specific environments:
Copy file name to clipboardExpand all lines: website/docs/en/config/output/minify.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
@@ -15,9 +15,9 @@ type Minify =
15
15
16
16
-**Default:**`true`
17
17
18
-
Configure whether to enable code minification in production mode, and to configure minimizer options.
18
+
Configure whether to enable code minification in production mode and configure minimizer options.
19
19
20
-
By default, JS and CSS code will be automatically minimized in production mode to improve page performance. If you do not want to minify the code, you can set `minify` to `false` to disable minification for all code. Alternatively, you can control the behavior of code minification through detailed configuration of the `minify` option. Below are detailed explanations for each configuration option:
20
+
By default, JS and CSS code are automatically minified in production mode to improve page performance. If you don't want to minify the code, you can set `minify` to `false` to disable minification for all code. Alternatively, you can control code minification behavior through detailed configuration of the `minify` option. Below are detailed explanations for each configuration option:
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.
0 commit comments