Skip to content

Commit 7b537b0

Browse files
authored
docs: improve code splitting documentation clarity (#5816)
1 parent 5be2237 commit 7b537b0

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

website/docs/en/guide/optimization/code-splitting.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Rsbuild supports the following chunk splitting strategies:
2323

2424
### Behavior
2525

26-
Rsbuild adopts the `split-by-experience` strategy by default, which is a strategy we have developed from experience. Specifically, when the following npm packages are referenced in your project, they will automatically be split into separate chunks:
26+
Rsbuild uses the `split-by-experience` strategy by default, which is an optimization strategy based on practical experience. When the following npm packages are referenced in the project, they will be automatically split into separate chunks:
2727

28-
- `lib-polyfill.js`: includes `core-js`, `@swc/helpers`, `tslib`.
29-
- `lib-axios.js`: includes `axios` and related packages.
28+
- `lib-polyfill.js`: Contains `core-js`, `@swc/helpers`, `tslib`
29+
- `lib-axios.js`: Contains `axios`
30+
- `lib-react.js`: Provided by [@rsbuild/plugin-react](/plugins/list/plugin-react#splitchunks)
31+
- `lib-vue.js`: Provided by [@rsbuild/plugin-vue](/plugins/list/plugin-vue#splitchunks)
3032

3133
Grouping commonly used packages in this way and then splitting them into individual chunks helps with browser caching.
3234

website/docs/en/plugins/list/plugin-react.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ Most of the time, you should use the plugin's [fastRefresh](#fastrefresh) option
128128

129129
When [chunkSplit.strategy](/config/performance/chunk-split) set to `split-by-experience`, Rsbuild will automatically split `react` and `router` related packages into separate chunks by default:
130130

131-
- `lib-react.js`: includes react, react-dom, and react's sub-dependencies (scheduler).
132-
- `lib-router.js`: includes react-router, react-router-dom, and react-router's sub-dependencies (history, @remix-run/router).
131+
- `lib-react.js`: includes `react`, `react-dom`, and their sub-dependencies (`scheduler`).
132+
- `lib-router.js`: includes `react-router`, `react-router-dom`, and their sub-dependencies (`history`, `@remix-run/router`).
133133

134134
This option is used to control this behavior and determine whether the `react` and `router` related packages need to be split into separate chunks.
135135

website/docs/en/plugins/list/plugin-vue.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ pluginVue({
6868

6969
When [chunkSplit.strategy](/config/performance/chunk-split) set to `split-by-experience`, Rsbuild will automatically split `vue` and `router` related packages into separate chunks by default:
7070

71-
- `lib-vue.js`: includes vue, vue-loader, and vue's sub-dependencies (@vue/shared, @vue/reactivity, @vue/runtime-dom, @vue/runtime-core).
72-
- `lib-router.js`: includes vue-router.
71+
- `lib-vue.js`: includes `vue`, `vue-loader`, and their sub-dependencies (`@vue/shared`, `@vue/reactivity`, `@vue/runtime-dom`, `@vue/runtime-core`).
72+
- `lib-router.js`: includes `vue-router`.
7373

7474
This option is used to control this behavior and determine whether the `vue` and `router` related packages need to be split into separate chunks.
7575

website/docs/zh/guide/optimization/code-splitting.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Rsbuild 支持设置以下几种拆包策略:
2323

2424
### 分包策略
2525

26-
Rsbuild 默认采用 `split-by-experience` 策略,这是我们根据经验制定的策略。具体来说,当你的项目中引用了以下 npm 包时,它们会自动被拆分为单独的 chunk:
26+
Rsbuild 默认采用 `split-by-experience` 策略,这是基于实践经验制定的优化策略。当项目中引用以下 npm 包时,它们会自动拆分为独立的 chunk:
2727

28-
- `lib-polyfill.js`:包含 `core-js``@swc/helpers``tslib`
29-
- `lib-axios.js`:包含 `axios` 以及相关的包。
28+
- `lib-polyfill.js`:包含 `core-js``@swc/helpers``tslib`
29+
- `lib-axios.js`:包含 `axios`
30+
- `lib-react.js`:由 [@rsbuild/plugin-react](/plugins/list/plugin-react#splitchunks) 提供
31+
- `lib-vue.js`:由 [@rsbuild/plugin-vue](/plugins/list/plugin-vue#splitchunks) 提供
3032

3133
这种方式将常用的包进行分组,然后拆分为单独的 chunk,有助于浏览器缓存。
3234

website/docs/zh/plugins/list/plugin-react.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ pluginReact({
130130

131131
[chunkSplit.strategy](/config/performance/chunk-split) 设置为 `split-by-experience` 时,Rsbuild 默认会自动将 `react``router` 相关的包拆分为单独的 chunk:
132132

133-
- `lib-react.js`:包含 reactreact-dom,以及 react 的子依赖(scheduler)。
134-
- `lib-router.js`:包含 react-routerreact-router-dom,以及 react-router 的子依赖(history@remix-run/router)。
133+
- `lib-react.js`:包含 `react``react-dom`,以及它们的子依赖(`scheduler`)。
134+
- `lib-router.js`:包含 `react-router``react-router-dom`,以及它们的子依赖(`history``@remix-run/router`)。
135135

136136
该选项用于控制这一行为,决定是否需要将 `react``router` 相关的包拆分为单独的 chunk。
137137

website/docs/zh/plugins/list/plugin-vue.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ pluginVue({
6868

6969
[chunkSplit.strategy](/config/performance/chunk-split) 设置为 `split-by-experience` 时,Rsbuild 默认会自动将 `vue``router` 相关的包拆分为单独的 chunk:
7070

71-
- `lib-vue.js`:包含 vuevue-loader,以及 vue 的子依赖(@vue/shared@vue/reactivity@vue/runtime-dom@vue/runtime-core)。
72-
- `lib-router.js`:包含 vue-router。
71+
- `lib-vue.js`:包含 `vue``vue-loader`,以及它们的子依赖(`@vue/shared``@vue/reactivity``@vue/runtime-dom``@vue/runtime-core`)。
72+
- `lib-router.js`:包含 `vue-router`
7373

7474
该选项用于控制这一行为,决定是否需要将 `vue``router` 相关的包拆分为单独的 chunk。
7575

0 commit comments

Comments
 (0)