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/config/server/open.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
@@ -23,7 +23,7 @@ type Open =
23
23
24
24
`server.open` can be set to the following values.
25
25
26
-
- Open the project's default preview page, which defaults to `http://localhost:<port>`. If[server.host](/config/server/host) is configured, it defaults to `http://<host>:<port>`.
26
+
- Open the project's default preview page (`http://localhost:<port>`, or `http://<host>:<port>` if[server.host](/config/server/host) is configured).
27
27
28
28
```ts title="rsbuild.config.ts"
29
29
exportdefault {
@@ -75,7 +75,7 @@ export default {
75
75
76
76
## Port placeholder
77
77
78
-
The port number that Rsbuild server listens on may change. For example, if the port is in use, Rsbuild will automatically increment the port number until it finds an available port.
78
+
The port number that Rsbuild server listens on may change. For example, if the port is already in use, Rsbuild will automatically increment the port number until it finds an available port.
79
79
80
80
To avoid `server.open` becoming invalid due to port changes, you can use one of the following methods:
Copy file name to clipboardExpand all lines: website/docs/en/guide/advanced/browser-compatibility.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
@@ -10,7 +10,7 @@ Before dealing with compatibility issues, you first need to determine which brow
10
10
11
11
- If you haven't set browserslist yet, please read the [Browserslist](/guide/advanced/browserslist) chapter first.
12
12
13
-
- If you have set a browserslist, Rsbuild will automatically compile according to that scope, downgrade JavaScript syntax and CSS syntax, and inject the required polyfill. In most cases, you can safely use modern ECMAScript features without worrying about compatibility issues.
13
+
- If you have set a browserslist, Rsbuild will automatically compile to match that scope, downgrade JavaScript and CSS syntax, and inject the required polyfills. In most cases, you can safely use modern ECMAScript features without worrying about compatibility issues.
14
14
15
15
After setting the browserslist, if you still encounter compatibility issues, please continue reading the content below to find solutions.
Copy file name to clipboardExpand all lines: website/docs/en/guide/advanced/env-vars.mdx
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -222,7 +222,7 @@ export default {
222
222
223
223
## `.env` file
224
224
225
-
When a `.env` file exists in the project root directory, Rsbuild CLI automatically uses [dotenv](https://npmjs.com/package/dotenv) to load these environment variables and add them to the current Node.js process. The [Public Variables](#public-variables) will be exposed in client code.
225
+
When a `.env` file exists in the project root directory, Rsbuild CLI automatically uses [dotenv](https://npmjs.com/package/dotenv) to load these environment variables and add them to the current Node.js process. [Public Variables](#public-variables) will be exposed in client code.
226
226
227
227
You can access these environment variables through `import.meta.env.[name]` or `process.env.[name]`.
228
228
@@ -233,13 +233,13 @@ Rsbuild supports reading the following types of env files:
| `.env.local` | Local usage of the `.env` file, should be added to .gitignore. |
236
+
| `.env.local` | Local overrides for `.env`, should be added to `.gitignore`. |
237
237
| `.env.development` | Read when `process.env.NODE_ENV` is `'development'`. |
238
238
| `.env.production` | Read when `process.env.NODE_ENV` is `'production'`. |
239
-
| `.env.development.local` | Local usage of the `.env.development` file, should be added to .gitignore. |
240
-
| `.env.production.local` | Local usage of the `.env.production` file, should be added to .gitignore. |
239
+
| `.env.development.local` | Local overrides for `.env.development`, should be added to `.gitignore`. |
240
+
| `.env.production.local` | Local overrides for `.env.production`, should be added to `.gitignore`. |
241
241
242
-
If multiple of the above files exist, they will all be loaded, with files listed lower in the table having higher priority.
242
+
If multiple of the above files exist, they will all be loaded. Files listed lower in the table have higher priority.
243
243
244
244
### Env mode
245
245
@@ -251,7 +251,7 @@ For example, set the env mode as `test`:
251
251
npx rsbuild dev --env-mode test
252
252
```
253
253
254
-
Rsbuild will read these files in the following order and merge their contents. If the same environment variable is defined in multiple files, values from files loaded later will override those from files loaded earlier:
254
+
Rsbuild will read these files in the following order and merge their contents. If the same environment variable is defined in multiple files, files loaded later will override those loaded earlier:
255
255
256
256
- .env
257
257
- .env.local
@@ -275,7 +275,7 @@ For example, to specify the env directory as `config`:
275
275
npx rsbuild dev --env-dir config
276
276
```
277
277
278
-
In this case, Rsbuild will read the `./config/.env` and other env files.
278
+
Rsbuild will then read `./config/.env` and other env files from that directory.
- The content of public variables will be exposed to your client code, so please avoid including sensitive information in public variables.
364
-
- Public variables are replaced through [source.define](/config/source/define). Please read ["Using define"](#using-define) to understand the principles and notes of define.
364
+
- Public variables are replaced through [source.define](/config/source/define). Read ["Using define"](#using-define) to understand the principles and caveats of define.
365
365
366
366
:::
367
367
@@ -471,10 +471,10 @@ export default {
471
471
472
472
If you use the above approach, it will cause the following problems:
473
473
474
-
1. Some unused environment variables are additionally injected, causing the dev server's environment variables to leak into the frontend code.
475
-
2. Each`process.env` reference will be replaced by a complete environment variable object, increasing bundle size and decreasing performance.
474
+
1. Unused environment variables are injected unnecessarily, causing the dev server's environment variables to leak into the frontend code.
475
+
2. Every`process.env` reference will be replaced with the complete environment variable object, increasing bundle size and reducing performance.
476
476
477
-
Therefore, inject environment variables on `process.env` according to actual needs and avoid replacing it entirely.
477
+
Therefore, only inject the specific environment variables you need on `process.env`, and avoid replacing it entirely.
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 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 follow certain 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 React component hot updates don't work, or the component state is lost after hot updates, it's usually because your React component uses an anonymous function. React Fast Refresh requires that components cannot be anonymous functions, otherwise component state cannot be preserved after hot updates.
Copy file name to clipboardExpand all lines: website/docs/en/guide/optimization/build-performance.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
@@ -8,7 +8,7 @@ This document provides optional optimization methods to improve build performanc
8
8
9
9
Performance profiling helps identify bottlenecks in your project, enabling targeted optimization.
10
10
11
-
Please refer to the [Build Performance Analysis](/guide/debug/build-profiling) section.
11
+
See the [Build Performance Analysis](/guide/debug/build-profiling) section.
12
12
13
13
## General optimization
14
14
@@ -30,13 +30,13 @@ Optimizing the number of modules referenced by the application reduces bundle si
30
30
31
31
When using Tailwind CSS v3, incorrectly configuring the `content` field in `tailwind.config.js` can lead to poor build and HMR performance.
32
32
33
-
Refer to[Tailwind CSS v3 - Optimize build performance](/guide/styling/tailwindcss-v3#optimize-build-performance) for more details.
33
+
See[Tailwind CSS v3 - Optimize build performance](/guide/styling/tailwindcss-v3#optimize-build-performance) for more details.
34
34
35
35
### Parallel Less compilation
36
36
37
37
If your project uses the [@rsbuild/plugin-less](/plugins/list/plugin-less) plugin with a large number of Less files, you can try enabling parallel compilation to improve build performance.
38
38
39
-
Refer to[Less Plugin - parallel](/plugins/list/plugin-less#parallel) for more details.
39
+
See[Less Plugin - parallel](/plugins/list/plugin-less#parallel) for more details.
40
40
41
41
### Tool selection
42
42
@@ -62,7 +62,7 @@ export default {
62
62
};
63
63
```
64
64
65
-
> Refer to[dev.lazyCompilation](/config/dev/lazy-compilation) for more information.
65
+
> See[dev.lazyCompilation](/config/dev/lazy-compilation) for more information.
Copy file name to clipboardExpand all lines: website/docs/en/guide/optimization/code-splitting.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
@@ -14,13 +14,13 @@ Rsbuild supports the following chunk splitting strategies:
14
14
15
15
-`split-by-experience`: an empirical splitting strategy, automatically splits some commonly used npm packages into chunks of moderate size.
16
16
-`split-by-module`: split by NPM package granularity, each NPM package corresponds to a chunk.
17
-
-`split-by-size`: automatically split according to module size.
17
+
-`split-by-size`: automatically split based on module size.
18
18
-`all-in-one`: bundle all codes into one chunk.
19
19
-`single-vendor`: bundle all NPM packages into a single chunk.
20
20
-`custom`: custom chunk splitting strategy.
21
21
22
22
::: tip
23
-
When using strategies other than `all-in-one`, Rspack's default splitting rules will also take effect. For more details, please refer to[Rspack - SplitChunksPlugin](https://rspack.rs/plugins/webpack/split-chunks-plugin#default-behavior).
23
+
When using strategies other than `all-in-one`, Rspack's default splitting rules will also take effect. For more details, see[Rspack - SplitChunksPlugin](https://rspack.rs/plugins/webpack/split-chunks-plugin#default-behavior).
24
24
:::
25
25
26
26
## split-by-experience
@@ -238,7 +238,7 @@ export default {
238
238
};
239
239
```
240
240
241
-
The `override` config will be merged with Rspack's `splitChunks` config. For specific config details, please refer to[Rspack - splitChunks](https://rspack.rs/config/optimization#optimizationsplitchunks).
241
+
The `override` config will be merged with Rspack's `splitChunks` config. For specific config details, see[Rspack - splitChunks](https://rspack.rs/config/optimization#optimizationsplitchunks).
Copy file name to clipboardExpand all lines: website/docs/en/guide/optimization/inline-assets.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
@@ -2,7 +2,7 @@
2
2
3
3
Inlining static assets refers to embedding the content of a static asset directly in an HTML or JS file, instead of linking to an external file. This can improve website performance by reducing the number of HTTP requests the browser needs to make to load the page.
4
4
5
-
However, inlining static assets has some disadvantages, such as increasing the size of a single file, which may lead to slower loading. Therefore, you should decide whether to inline assets based on your specific situation.
5
+
However, inlining static assets has some disadvantages, such as increasing the size of a single file, which may lead to slower loading. You should decide whether to inline assets based on your specific situation.
6
6
7
7
Rsbuild automatically inlines static assets smaller than 4KiB. Sometimes you may need to manually control whether assets are inlined. This document explains how to precisely control the inlining behavior of static assets.
Copy file name to clipboardExpand all lines: website/docs/en/guide/optimization/optimize-bundle.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
@@ -52,7 +52,7 @@ See the [performance.bundleAnalyze](/config/performance/bundle-analyze) configur
52
52
53
53
## Adjust browserslist
54
54
55
-
The Rsbuild will compile the code according to the project's Browserslist config, and inject some Polyfills. If the project does not need to be compatible with legacy browsers, you can adjust the Browserslist and drop some legacy browsers, thereby reducing the compilation overhead on syntax and polyfill.
55
+
Rsbuild will compile the code based on the project's browserslist config and inject some polyfills. If your project doesn't need to support legacy browsers, you can adjust the browserslist to drop support for older browsers, reducing the compilation overhead for syntax transformation and polyfills.
Copy file name to clipboardExpand all lines: website/docs/en/guide/styling/tailwindcss-v3.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
@@ -43,7 +43,7 @@ module.exports = {
43
43
The above configuration is for reference only and can be modified to suit the needs of your project. For example, non-TypeScript projects do not need to include ts and tsx files.
44
44
:::
45
45
46
-
It should be noted that the `content` option should include the paths to all source files that contain Tailwind class names. For details, please refer to[tailwindcss - Content Configuration](https://v3.tailwindcss.com/docs/content-configuration).
46
+
Note that the `content` option should include the paths to all source files that contain Tailwind class names. For details, see[tailwindcss - Content Configuration](https://v3.tailwindcss.com/docs/content-configuration).
0 commit comments