@rsdoctor/docs 0.4.6 → 0.4.8
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.
- package/docs/en/blog/topic/loader-optimization.mdx +1 -1
- package/docs/en/config/options/options-shared.mdx +1 -1
- package/docs/en/config/options/options.mdx +1 -1
- package/docs/en/guide/more/faq.mdx +8 -0
- package/docs/en/guide/start/cli.mdx +1 -1
- package/docs/en/guide/usage/bundle-diff.mdx +1 -1
- package/docs/en/guide/usage/loaders-analysis.mdx +1 -1
- package/docs/en/guide/usage/rule-config.mdx +1 -1
- package/docs/zh/blog/topic/loader-optimization.mdx +1 -1
- package/docs/zh/config/options/options-shared.mdx +1 -1
- package/docs/zh/config/options/options.mdx +1 -1
- package/docs/zh/guide/more/faq.mdx +8 -0
- package/docs/zh/guide/start/cli.mdx +1 -1
- package/docs/zh/guide/usage/bundle-diff.mdx +1 -1
- package/docs/zh/guide/usage/loaders-analysis.mdx +1 -1
- package/docs/zh/guide/usage/rule-config.mdx +1 -1
- package/package.json +9 -7
|
@@ -23,7 +23,7 @@ With the Loader Analysis module provided by Rsdoctor, we can see **a tree struct
|
|
|
23
23
|
|
|
24
24
|
### Analyzing Directories
|
|
25
25
|
|
|
26
|
-
By **clicking on a directory**, you can see the **time-consuming statistics of all loaders** under the currently **selected directory** on the right side of the file tree, such as the number of files processed by a loader and **the estimated time** consumption. The content of the "Statistics of
|
|
26
|
+
By **clicking on a directory**, you can see the **time-consuming statistics of all loaders** under the currently **selected directory** on the right side of the file tree, such as the number of files processed by a loader and **the estimated time** consumption. The content of the "Statistics of \*\*\*" card is shown in the following figure:
|
|
27
27
|
|
|
28
28
|
<img
|
|
29
29
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/compile/loader-anlaysis-table.png"
|
|
@@ -29,7 +29,7 @@ The `features` attribute is used to analyze the function switches, and the speci
|
|
|
29
29
|
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
30
30
|
- **bundle**: Analysis of build artifacts, enabled by default.
|
|
31
31
|
- **resolver**: resolver analysis, disabled by default.
|
|
32
|
-
- **lite**: [**
|
|
32
|
+
- **lite**: [**deprecated, please use [mode.lite](#mode)**]
|
|
33
33
|
lite mode. The difference between lite mode and normal mode is that source code information is no longer cached, only packaged code information is cached, so the code analyzed on the page will also be packaged. The default is normal mode.
|
|
34
34
|
|
|
35
35
|
Therefore, **the default configuration enables bundle analysis capabilities and Loader and Plugin build-time analysis**. The Resolver analysis capability is not enabled, and Rspack does not currently support Resolver analysis capabilities.
|
|
@@ -99,7 +99,7 @@ The `features` attribute is used to analyze the function switches, and the speci
|
|
|
99
99
|
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
100
100
|
- **bundle**: Analysis of build bundles, enabled by default.
|
|
101
101
|
- **resolver**: resolver analysis, disabled by default.
|
|
102
|
-
- **lite**: [**
|
|
102
|
+
- **lite**: [**deprecated, please use [mode.lite](#mode)**]
|
|
103
103
|
lite mode. The difference between lite mode and normal mode is that source code information is no longer cached, only packaged code information is cached, so the code analyzed on the page will also be packaged. The default is normal mode.
|
|
104
104
|
|
|
105
105
|
Therefore, **the default configuration enables bundle analysis capabilities and Loader and Plugin build-time analysis**. The Resolver analysis capability is not enabled, and Rspack does not currently support Resolver analysis capabilities.
|
|
@@ -61,6 +61,14 @@ module.exports = {
|
|
|
61
61
|
- Cause: During the build process, the source code information is stored, which exceeds the memory limit. Enabling the `lite` mode can alleviate this issue.
|
|
62
62
|
- Difference: The difference between the **lite mode** and the **normal mode** is that the **lite mode** no longer stores the **source code information**, only the **bundled code** is stored. Additionally, the code displayed in the analysis report will only consist of the **bundled code**.
|
|
63
63
|
|
|
64
|
+
## The loader of CssExtractRspackPlugin takes too long
|
|
65
|
+
|
|
66
|
+
When using Rsdoctor to analyze the compilation time of Rspack projects, you may find that the loader of [CssExtractRspackPlugin](https://rspack.dev/plugins/rspack/css-extract-rspack-plugin) takes a long time. However, this figure does not represent the actual time taken by the CssExtractRspackPlugin's loader; it also includes the time taken by other loaders involved in compiling this module.
|
|
67
|
+
|
|
68
|
+
- Reason: The loader in [CssExtractRspackPlugin](https://rspack.dev/plugins/rspack/css-extract-rspack-plugin) asynchronously calls other loaders during the pitch phase and waits for the callback results after these loaders execute. Therefore, the time taken by CssExtractRspackPlugin actually includes the execution time of other loaders and idle time.
|
|
69
|
+
|
|
70
|
+
<img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/4ffe579c62f6e8d995b7856d608abdef61219155/rsdoctor/css-extract-loader.png" />
|
|
71
|
+
|
|
64
72
|
## Next.js
|
|
65
73
|
|
|
66
74
|
### Issue with Next.js project report page
|
|
@@ -106,7 +106,7 @@ If you need to directly execute the [analyze command](#analyze-command) through
|
|
|
106
106
|
execute('analyze', {
|
|
107
107
|
profile: 'input the manifest.json path or url',
|
|
108
108
|
}).then((sdk) => {
|
|
109
|
-
console.log('execute "
|
|
109
|
+
console.log('execute "analyze" command success');
|
|
110
110
|
// you can stop the Rsdoctor's dev-server by calling the sdk'api below:
|
|
111
111
|
// sdk.dispose();
|
|
112
112
|
});
|
|
@@ -95,7 +95,7 @@ In the Assets module, we can see the **size** and **change rate** of the build f
|
|
|
95
95
|
|
|
96
96
|
<img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets-list.png" />
|
|
97
97
|
|
|
98
|
-
By **clicking** the **"+" button** in front of the list items, you can expand to see the **list of modules** contained in the corresponding Asset (i.e., `Modules of "
|
|
98
|
+
By **clicking** the **"+" button** in front of the list items, you can expand to see the **list of modules** contained in the corresponding Asset (i.e., `Modules of "***"`), which shows the **size** and **change rate** of the modules.
|
|
99
99
|
|
|
100
100
|
<img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets.png" />
|
|
101
101
|
|
|
@@ -25,7 +25,7 @@ The corresponding details will be explained in the following paragraphs.
|
|
|
25
25
|
|
|
26
26
|
## Loader Data for File Directories
|
|
27
27
|
|
|
28
|
-
By **clicking on a selected directory**, you can see the **time statistics of all Loaders in the selected directory** ([estimated time consumption](../../guide/more/faq#loader-time-consuming-data-is-inaccurate)) on the right side of the file tree. The content of the "Statistics of
|
|
28
|
+
By **clicking on a selected directory**, you can see the **time statistics of all Loaders in the selected directory** ([estimated time consumption](../../guide/more/faq#loader-time-consuming-data-is-inaccurate)) on the right side of the file tree. The content of the "Statistics of \*\*\*" card is shown in the following image:
|
|
29
29
|
|
|
30
30
|
<img
|
|
31
31
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/compile/loader-anlaysis-table.png"
|
|
@@ -23,7 +23,7 @@ import Step from '@components/Step';
|
|
|
23
23
|
|
|
24
24
|
### 分析目录
|
|
25
25
|
|
|
26
|
-
通过 **点击选中目录** 可以在**文件树**的右侧,看到当前**选中目录下所有 Loader 的耗时统计数据**([**预估耗时**]()),即 `"Statistics of
|
|
26
|
+
通过 **点击选中目录** 可以在**文件树**的右侧,看到当前**选中目录下所有 Loader 的耗时统计数据**([**预估耗时**]()),即 `"Statistics of ***"` 的卡片内容如下图所示:
|
|
27
27
|
|
|
28
28
|
<img
|
|
29
29
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/compile/loader-anlaysis-table.png"
|
|
@@ -35,7 +35,7 @@ features 属性是用于分析功能开关的,具体的功能项如下:
|
|
|
35
35
|
- **resolver**:resolver 分析,默认关闭。
|
|
36
36
|
- **lite**: **(废弃,参考:[mode.lite]())** lite 模式。lite 模式和普通模式的区别就是不再缓存源码信息,只缓存打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
37
37
|
|
|
38
|
-
所以,**默认配置是开启了 Bundle 分析能力、 Loader
|
|
38
|
+
所以,**默认配置是开启了 Bundle 分析能力、 Loader 和 Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
39
39
|
|
|
40
40
|
:::tip
|
|
41
41
|
**如果出现了 out of memory 的报错,可以尝试:**
|
|
@@ -105,7 +105,7 @@ features 属性是用于分析功能开关的,具体的功能项如下:
|
|
|
105
105
|
- **resolver**:resolver 分析,默认关闭。
|
|
106
106
|
- **lite**: **(废弃,使用 [mode.lite](#mode))** lite 模式。lite 模式和普通模式的区别就是不再展示源码信息,只展示打包后的代码信息,这样分析页面上的代码也将是打包后的。默认普通模式。
|
|
107
107
|
|
|
108
|
-
所以,**默认配置是开启了 Bundle 分析能力、 Loader
|
|
108
|
+
所以,**默认配置是开启了 Bundle 分析能力、 Loader 和 Plugin 构建时分析**。没有开启 Resolver 分析能力, Rspack 暂不支持 Resolver 分析能力。
|
|
109
109
|
|
|
110
110
|
:::tip
|
|
111
111
|
**如果出现了 out of memory 的报错,可以尝试:**
|
|
@@ -59,6 +59,14 @@ module.exports = {
|
|
|
59
59
|
- 原因:因为构建过程中,存储了源码信息,超过了内存,所以开启 `lite` 模式可以缓解。
|
|
60
60
|
- 区别:`lite` 模式和普通模式的区别就是不再存储**源码信息**,只存储**打包后的代码**,同时分析报告上的代码也将**只有打包后的代码**。
|
|
61
61
|
|
|
62
|
+
## CssExtractRspackPlugin 的 loader 耗时过长问题
|
|
63
|
+
|
|
64
|
+
在使用 Rsdoctor 对 Rspack 项目进行编译耗时分析时,可能会发现 [CssExtractRspackPlugin](https://rspack.dev/plugins/rspack/css-extract-rspack-plugin) 的 loader 耗时较长。然而,这个数值并不代表 CssExtractRspackPlugin 的 loader 的真实耗时,它还包含了对本模块编译的其他 loader 的耗时。
|
|
65
|
+
|
|
66
|
+
- 原因:[CssExtractRspackPlugin](https://rspack.dev/plugins/rspack/css-extract-rspack-plugin) 中的 loader 在 pitch 阶段会异步调用其他 loader,并等待这些 loader 执行后的回调结果。因此,CssExtractRspackPlugin 的耗时实际上包括了其他 loader 的执行时间和空闲时间。
|
|
67
|
+
|
|
68
|
+
<img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/4ffe579c62f6e8d995b7856d608abdef61219155/rsdoctor/css-extract-loader.png" />
|
|
69
|
+
|
|
62
70
|
## Next.js
|
|
63
71
|
|
|
64
72
|
### Next.js 项目报告页面问题
|
|
@@ -106,7 +106,7 @@ import { execute } from '@rsdoctor/cli';
|
|
|
106
106
|
execute('analyze', {
|
|
107
107
|
profile: 'input the manifest.json path or url',
|
|
108
108
|
}).then((sdk) => {
|
|
109
|
-
console.log('execute "
|
|
109
|
+
console.log('execute "analyze" command success');
|
|
110
110
|
// you can stop the Rsdoctor's dev-server by calling the sdk'api below:
|
|
111
111
|
// sdk.dispose();
|
|
112
112
|
});
|
|
@@ -95,7 +95,7 @@ Rsdoctor 在展示 Asset 名称时,会尝试移除产物文件名中的 hash
|
|
|
95
95
|
|
|
96
96
|
<img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets-list.png" />
|
|
97
97
|
|
|
98
|
-
同时**点击**列表项目前的 **"+" 按钮**,则可以展开看到对应 Asset 所**包含的模块列表**(即 `Modules of "
|
|
98
|
+
同时**点击**列表项目前的 **"+" 按钮**,则可以展开看到对应 Asset 所**包含的模块列表**(即 `Modules of "***"`),其中则会显示模块之间的**体积**以及**变化幅度**。
|
|
99
99
|
|
|
100
100
|
<img src="https://raw.githubusercontent.com/rspack-contrib/rstack-design-resources/632e3087495b569de77a93235196fdacf09627d5/others/assets/rsdoctor/bundle-diff-assets.png" />
|
|
101
101
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
## 文件目录的 Loaders 数据
|
|
28
28
|
|
|
29
|
-
通过 **点击选中目录** 可以在 文件树 的右侧,看到当前**选中目录下所有 Loader 的耗时统计数据**([**预估耗时**](../../guide/more/faq#loader-%E8%80%97%E6%97%B6%E6%95%B0%E6%8D%AE%E4%B8%8D%E5%87%86)),即 `"Statistics of
|
|
29
|
+
通过 **点击选中目录** 可以在 文件树 的右侧,看到当前**选中目录下所有 Loader 的耗时统计数据**([**预估耗时**](../../guide/more/faq#loader-%E8%80%97%E6%97%B6%E6%95%B0%E6%8D%AE%E4%B8%8D%E5%87%86)),即 `"Statistics of ***"` 的卡片内容如下图所示:
|
|
30
30
|
|
|
31
31
|
<img
|
|
32
32
|
src="https://lf3-static.bytednsdoc.com/obj/eden-cn/lognuvj/rsdoctor/docs/usage/compile/loader-anlaysis-table.png"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/docs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -20,20 +20,22 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^16",
|
|
23
|
-
"@types/react": "^18.3.
|
|
24
|
-
"@types/react-dom": "^18",
|
|
25
|
-
"react": "18.
|
|
26
|
-
"react-dom": "18.
|
|
23
|
+
"@types/react": "^18.3.11",
|
|
24
|
+
"@types/react-dom": "^18.3.1",
|
|
25
|
+
"react": "18.3.1",
|
|
26
|
+
"react-dom": "18.3.1",
|
|
27
27
|
"rsbuild-plugin-google-analytics": "^1.0.3",
|
|
28
28
|
"rsbuild-plugin-open-graph": "^1.0.2",
|
|
29
29
|
"rspress-plugin-font-open-sans": "^1.0.0",
|
|
30
|
+
"rspress-plugin-sitemap": "^1.1.1",
|
|
31
|
+
"@rspress/plugin-rss": "^1.33.1",
|
|
30
32
|
"typescript": "^5.2.2",
|
|
31
|
-
"@rsdoctor/types": "0.4.
|
|
33
|
+
"@rsdoctor/types": "0.4.8"
|
|
32
34
|
},
|
|
33
35
|
"dependencies": {
|
|
34
36
|
"react-markdown": "^9.0.1",
|
|
35
37
|
"@rstack-dev/doc-ui": "1.5.2",
|
|
36
|
-
"rspress": "^1.
|
|
38
|
+
"rspress": "^1.33.1"
|
|
37
39
|
},
|
|
38
40
|
"scripts": {
|
|
39
41
|
"dev": "rspress dev",
|