@modern-js/main-doc 2.68.8 → 2.68.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,9 +96,23 @@ See details in [plugin-image-compress](https://github.com/rspack-contrib/rsbuild
96
96
 
97
97
  ## Split Chunk
98
98
 
99
- A great chunk splitting strategy is very important to improve the loading performance of the application. It can make full use of the browser's caching mechanism to reduce the number of requests and improve the loading speed of the application.
100
-
101
- A variety of [chunk splitting strategies](https://rsbuild.rs/guide/optimization/split-chunk) are built into Modern.js, which can meet the needs of most applications. You can also customize the chunk splitting config according to your own business scenarios.
99
+ A great code splitting strategy is very important to improve the loading performance of the application. It can make full use of the browser's caching mechanism to reduce the number of requests and improve the loading speed of the application.
100
+
101
+ Modern.js provides the same [Code Splitting](https://rsbuild.rs/zh/guide/optimization/code-splitting) as Rsbuild. But there are some differences in the default strategy `split-by-experience`.
102
+
103
+ When the project installs `antd`, `@arco-design/web-react`, or `@douyinfe/semi-ui` packages, it will automatically add the corresponding group. The implementation reference is as follows:
104
+
105
+ ```ts
106
+ if (isPackageInstalled('antd', rootPath)) {
107
+ groups.antd = ['antd'];
108
+ }
109
+ if (isPackageInstalled('@arco-design/web-react', rootPath)) {
110
+ groups.arco = [/@?arco-design/];
111
+ }
112
+ if (isPackageInstalled('@douyinfe/semi-ui', rootPath)) {
113
+ groups.semi = [/@(ies|douyinfe)[\\/]semi-.*/];
114
+ }
115
+ ```
102
116
 
103
117
  For example, split the `axios` library under node_modules into `axios.js`:
104
118
 
@@ -98,9 +98,23 @@ export default {
98
98
 
99
99
  良好的拆包策略对于提升应用的加载性能是十分重要的,可以充分利用浏览器的缓存机制,减少请求数量,加快页面加载速度。
100
100
 
101
- Modern.js 中内置了[多种拆包策略](https://rsbuild.rs/zh/guide/optimization/split-chunk),可以满足大部分应用的需求,你也可以根据自己的业务场景,自定义拆包配置。
101
+ Modern.js 提供了与 Rsbuild 相同的[拆包策略](https://rsbuild.rs/zh/guide/optimization/code-splitting),但在默认策略 `split-by-experience` 上有些许差异。
102
+
103
+ 当项目中安装了 `antd`、`@arco-design/web-react` 或 `@douyinfe/semi-ui` 包时,会自动添加对应的分组。具体实现参考:
104
+
105
+ ```ts
106
+ if (isPackageInstalled('antd', rootPath)) {
107
+ groups.antd = ['antd'];
108
+ }
109
+ if (isPackageInstalled('@arco-design/web-react', rootPath)) {
110
+ groups.arco = [/@?arco-design/];
111
+ }
112
+ if (isPackageInstalled('@douyinfe/semi-ui', rootPath)) {
113
+ groups.semi = [/@(ies|douyinfe)[\\/]semi-.*/];
114
+ }
115
+ ```
102
116
 
103
- 比如将 node_modules 下的 `axios` 库拆分到 `axios.js` 中:
117
+ 内置的策略可以满足大部分应用的需求,你也可以根据自己的业务场景,自定义拆包配置。比如将 node_modules 下的 `axios` 库拆分到 `axios.js` 中:
104
118
 
105
119
  ```js
106
120
  export default {
package/package.json CHANGED
@@ -15,14 +15,14 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.68.8",
18
+ "version": "2.68.10",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
24
  "mermaid": "^11.4.1",
25
- "@modern-js/sandpack-react": "2.68.8"
25
+ "@modern-js/sandpack-react": "2.68.10"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@rsbuild/plugin-sass": "1.3.5",
package/rspress.config.ts CHANGED
@@ -77,6 +77,12 @@ export default defineConfig({
77
77
  mode: 'link',
78
78
  content: 'https://github.com/web-infra-dev/modern.js',
79
79
  },
80
+ {
81
+ icon: 'lark',
82
+ mode: 'link',
83
+ content:
84
+ 'https://applink.larkoffice.com/client/chat/chatter/add_by_link?link_token=d21hc667-9403-48a9-ba32-bc1440a80279',
85
+ },
80
86
  ],
81
87
  },
82
88
  route: {