@rsdoctor/docs 1.2.4-beta.0 → 1.2.4-beta.2
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/{_meta.json → _nav.json} +5 -0
- package/docs/en/config/options/_meta.json +13 -1
- package/docs/en/config/options/brief.mdx +35 -0
- package/docs/en/config/options/disableClientServer.mdx +11 -0
- package/docs/en/config/options/experiments.mdx +21 -0
- package/docs/en/config/options/features.mdx +70 -0
- package/docs/en/config/options/mode.mdx +20 -0
- package/docs/en/config/options/options-v2.mdx +40 -0
- package/docs/en/config/options/options.mdx +61 -266
- package/docs/en/config/options/output.mdx +162 -0
- package/docs/en/config/options/port.mdx +7 -0
- package/docs/en/config/options/supports.mdx +72 -0
- package/docs/en/config/options/term.mdx +36 -3
- package/docs/en/guide/rules/rule-custom.mdx +1 -11
- package/docs/en/guide/start/cli.mdx +5 -5
- package/docs/en/guide/start/quick-start-shared.mdx +1 -1
- package/docs/en/guide/usage/module-analysis.mdx +1 -2
- package/docs/en/shared/mode-intro.md +2 -1
- package/docs/public/netlify.toml +12 -0
- package/docs/zh/{_meta.json → _nav.json} +5 -0
- package/docs/zh/config/options/_meta.json +13 -1
- package/docs/zh/config/options/brief.mdx +35 -0
- package/docs/zh/config/options/disableClientServer.mdx +11 -0
- package/docs/zh/config/options/experiments.mdx +21 -0
- package/docs/zh/config/options/features.mdx +70 -0
- package/docs/zh/config/options/mode.mdx +20 -0
- package/docs/zh/config/options/options-v2.mdx +40 -0
- package/docs/zh/config/options/options.mdx +61 -265
- package/docs/zh/config/options/output.mdx +162 -0
- package/docs/zh/config/options/port.mdx +7 -0
- package/docs/zh/config/options/supports.mdx +71 -0
- package/docs/zh/config/options/term.mdx +33 -0
- package/docs/zh/guide/rules/rule-custom.mdx +1 -11
- package/docs/zh/guide/start/cli.mdx +5 -5
- package/docs/zh/guide/start/quick-start-shared.mdx +1 -1
- package/docs/zh/guide/usage/module-analysis.mdx +1 -2
- package/docs/zh/shared/mode-intro.md +1 -0
- package/package.json +15 -13
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# brief
|
|
2
|
+
|
|
3
|
+
import { Badge } from '@theme';
|
|
4
|
+
|
|
5
|
+
:::warning
|
|
6
|
+
Deprecated in V2, please use [output.mode: 'brief'](/config/options/output#mode) instead. Refer to [brief configuration migration](/config/options/options-v2#brief).
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
- **Type:** [BriefType](#brieftype)
|
|
10
|
+
- **Optional:** `true`
|
|
11
|
+
- **Default:** `undefined`
|
|
12
|
+
|
|
13
|
+
Detailed configuration options for Brief mode are as follows:
|
|
14
|
+
|
|
15
|
+
- **reportHtmlName:** Configures the filename of the HTML report in Brief mode. The default value is `report-rsdoctor.html`.
|
|
16
|
+
- **writeDataJson:** (Deprecated, please use `output.options.type: ['json', 'html']`, refer to [output.options.type](/config/options/options-v2#options).) By default, Brief mode injects the analysis data directly into the HTML file, so no additional build analysis data files are generated. If you need to generate additional local JSON data files, you need to configure `writeDataJson: true`.
|
|
17
|
+
|
|
18
|
+
## briefType
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
interface BriefConfig {
|
|
22
|
+
reportHtmlName?: string | undefined;
|
|
23
|
+
writeDataJson: boolean;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- **Example:**
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
new RsdoctorRspackPlugin({
|
|
31
|
+
output: {
|
|
32
|
+
mode: 'brief',
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# disableClientServer
|
|
2
|
+
|
|
3
|
+
- **Type:** `boolean`
|
|
4
|
+
- **Optional:** `true`
|
|
5
|
+
- **Default:** `false`, when `process.CI` is true, the default value is true, meaning the report service is disabled by default in CI environments.
|
|
6
|
+
|
|
7
|
+
:::tip
|
|
8
|
+
It is recommended to set disableClientServer to true in CI environments, otherwise the started service will block the pipeline process.
|
|
9
|
+
:::
|
|
10
|
+
|
|
11
|
+
Whether to automatically open the Rsdoctor report page. If you do not need to view the analysis report provided by Rsdoctor in the browser, you can enable this configuration item.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Badge } from '@theme';
|
|
2
|
+
|
|
3
|
+
# experiments
|
|
4
|
+
|
|
5
|
+
<Badge text="Version: 1.0.0" type="warning" />
|
|
6
|
+
|
|
7
|
+
## enableNativePlugin
|
|
8
|
+
|
|
9
|
+
- **Type:** `boolean`
|
|
10
|
+
- **Optional:** `true`
|
|
11
|
+
- **Default:** `false`
|
|
12
|
+
|
|
13
|
+
By enabling the enableNativePlugin option, the Rspack native plugin moves the time-consuming data processing logic from Rsdoctor to the Rspack build stage, significantly improving build analysis efficiency and greatly reducing Rsdoctor's own analysis time.
|
|
14
|
+
|
|
15
|
+
- **Example:**
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
new RsdoctorRspackPlugin({
|
|
19
|
+
experiments: { enableNativePlugin: true }
|
|
20
|
+
}),
|
|
21
|
+
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# features
|
|
2
|
+
|
|
3
|
+
- **Type:** [RsdoctorWebpackPluginFeatures](#rsdoctorwebpackpluginfeatures) | [Array\<keyof RsdoctorWebpackPluginFeatures\>](#rsdoctorwebpackpluginfeatures) | [RsdoctorRspackPluginFeatures](#rsdoctorrspackpluginfeatures) | [Array\<keyof RsdoctorRspackPluginFeatures\>](#rsdoctorrspackpluginfeatures)
|
|
4
|
+
- **Optional:** `true`
|
|
5
|
+
- **Default:** `['loader', 'plugins', 'bundle']`
|
|
6
|
+
|
|
7
|
+
## Configuration Description
|
|
8
|
+
|
|
9
|
+
The `features` attribute is used for analysis feature toggles, and the specific functional items are as follows:
|
|
10
|
+
|
|
11
|
+
- **loader**: Loader time consumption and code compilation change analysis, enabled by default.
|
|
12
|
+
- **plugins**: Plugin calls and time consumption analysis, enabled by default.
|
|
13
|
+
- **bundle**: Build artifact analysis, enabled by default.
|
|
14
|
+
- **resolver**: Resolver analysis, disabled by default.
|
|
15
|
+
- **lite**: **(lite mode will be deprecated in V2, refer to [lite mode deprecation notice](/config/options/options-v2#lite))** lite mode. The difference between lite mode and normal mode is that source code information is no longer displayed, only packaged code information is displayed, so the code analyzed on the page will also be packaged. Default is normal mode.
|
|
16
|
+
|
|
17
|
+
Therefore, **the default configuration enables Bundle analysis capabilities, Loader and Plugin build-time analysis**. Resolver analysis capability is not enabled, and Rspack currently does not support Resolver analysis capabilities.
|
|
18
|
+
|
|
19
|
+
### Types
|
|
20
|
+
|
|
21
|
+
- If you set `features` as an **array** type, the plugin will **only enable** the features you define in the `features` array.
|
|
22
|
+
- If you set `features` as a **simple object** type, the plugin will **only disable** the features you set to `false` in the `features` object.
|
|
23
|
+
|
|
24
|
+
### Examples
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
new RsdoctorRspackPlugin({
|
|
28
|
+
// Only enable bundle, loader, plugins feature analysis, array form will override default configuration.
|
|
29
|
+
features: ['bundle', 'loader', 'plugins'],
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
new RsdoctorRspackPlugin({
|
|
35
|
+
features: {
|
|
36
|
+
// Disable bundle analysis, other feature analysis remains default
|
|
37
|
+
bundle: false,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Notes
|
|
43
|
+
|
|
44
|
+
:::tip
|
|
45
|
+
|
|
46
|
+
**If an "out of memory" error occurs, you can try the following:**
|
|
47
|
+
|
|
48
|
+
1. Enable **lite** mode.
|
|
49
|
+
2. Increase the node memory limit, for example: NODE_OPTIONS=--max-old-space-size=8096.
|
|
50
|
+
|
|
51
|
+
- Reason: Because during the build process, source code information is cached, which exceeds memory, so enabling `lite` mode can help alleviate this.
|
|
52
|
+
- Difference: 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.
|
|
53
|
+
|
|
54
|
+
:::
|
|
55
|
+
|
|
56
|
+
## RsdoctorWebpackPluginFeatures
|
|
57
|
+
|
|
58
|
+
`features` type:
|
|
59
|
+
|
|
60
|
+
import Features from '@en/shared/features.md';
|
|
61
|
+
|
|
62
|
+
<Features />
|
|
63
|
+
|
|
64
|
+
## RsdoctorRspackPluginFeatures
|
|
65
|
+
|
|
66
|
+
`features` type:
|
|
67
|
+
|
|
68
|
+
import FeaturesRspack from '@en/shared/features-rspack.md';
|
|
69
|
+
|
|
70
|
+
<FeaturesRspack />
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Badge } from '@theme';
|
|
2
|
+
|
|
3
|
+
# mode
|
|
4
|
+
|
|
5
|
+
:::warning
|
|
6
|
+
|
|
7
|
+
- Deprecated in V2, please use [output.mode](/config/options/output#mode) instead. Refer to [mode configuration migration](/config/options/options-v2#mode).
|
|
8
|
+
|
|
9
|
+
:::
|
|
10
|
+
|
|
11
|
+
- **Type:** `"normal" | "brief" | "lite"`
|
|
12
|
+
- lite mode will be deprecated in V2, refer to [lite mode deprecation notice](/config/options/options-v2#lite)
|
|
13
|
+
- **Optional:** `true`
|
|
14
|
+
- **Default:** `normal`
|
|
15
|
+
|
|
16
|
+
Select the Rsdoctor build report mode to use, which includes the following options:
|
|
17
|
+
|
|
18
|
+
import ModeIntro from '@en/shared/mode-intro.md';
|
|
19
|
+
|
|
20
|
+
<ModeIntro />
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Configuration Migration Guide
|
|
2
|
+
|
|
3
|
+
**Rsdoctor introduced new configuration options in version 1.2.4**. These new configuration options are easier to configure, more extensible, and compatible with the upcoming v2.0 release.
|
|
4
|
+
|
|
5
|
+
Configuration options from version 1.2.3 and earlier will still be supported, **but will be completely deprecated in Rsdoctor v2**, so we recommend migrating to the new configuration options in `1.2.4`.
|
|
6
|
+
|
|
7
|
+
| Original Configuration | New Configuration |
|
|
8
|
+
| ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| mode | Changed to configure `output.mode`. |
|
|
10
|
+
| brief | Changed to configure `mode: 'brief'`, and configure `output.options` `type` as `html`. |
|
|
11
|
+
| output.compressData | Changed to configure `mode: 'brief'`, and configure `output.options.type` as `json`. |
|
|
12
|
+
| `mode: 'lite'` or `feature: 'lite'` | Changed to configure `mode: 'normal'`, and configure `output.options.reportCodeType` as `noCode` or `noAssetsAndModuleSource`. |
|
|
13
|
+
| None | New `output.options.jsonOptions.section` configuration |
|
|
14
|
+
|
|
15
|
+
## Configuration Changes Details
|
|
16
|
+
|
|
17
|
+
### mode
|
|
18
|
+
|
|
19
|
+
The `mode` in the original configuration is migrated to the nested `output.mode` for better integration with other output-related configurations.
|
|
20
|
+
|
|
21
|
+
### brief
|
|
22
|
+
|
|
23
|
+
The current brief report mode outputs an HTML file as the report page. The new brief mode still supports JSON format, and for unified management of the same configuration, the brief configuration is moved to output.options.
|
|
24
|
+
The original `brief` configuration is changed to configure `output.mode: 'brief'`, and configure `output.options` `type` as `html`.
|
|
25
|
+
|
|
26
|
+
### output.compressData
|
|
27
|
+
|
|
28
|
+
The original `output.compressData` configuration is changed to configure `mode: 'brief'`, and configure `output.options.type` as `json`.
|
|
29
|
+
|
|
30
|
+
### lite
|
|
31
|
+
|
|
32
|
+
The internal logic of lite mode is equivalent to `output.options.reportCodeType` being `noCode` or `noAssetsAndModuleSource`, mainly to solve the problem of large projects being too slow when opening reports or OOM during build.
|
|
33
|
+
|
|
34
|
+
Considering that users cannot clearly distinguish the actual meaning of lite mode, having too many modes is not conducive to management and configuration, and the `output.options.reportCodeType` configuration is clearer, so `mode: 'lite'` will be deprecated in the future V2 version.
|
|
35
|
+
|
|
36
|
+
The original `mode: 'lite'` and `feature: 'lite'` configurations are changed to configure `mode: 'normal'`, and configure `output.options.reportCodeType` as `noCode` or `noAssetsAndModuleSource`.
|
|
37
|
+
|
|
38
|
+
### output.options.jsonOptions.section
|
|
39
|
+
|
|
40
|
+
Support for the new `output.options.jsonOptions.section` configuration for more granular JSON output option customization. For specific sections configuration items, refer to [output.options.jsonOptions.section](/config/options/output#jsonoptionssection).
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Badge } from '@theme';
|
|
1
|
+
import { Badge, Tab, Tabs } from '@theme';
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Overview
|
|
4
4
|
|
|
5
5
|
## RsdoctorRspackPlugin
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The **RsdoctorRspackPlugin** class is exported by `@rsdoctor/rspack-plugin`, and the configuration options are [RsdoctorRspackPluginOptions](#rsdoctorrspackpluginoptions).
|
|
8
8
|
|
|
9
9
|
<Tabs>
|
|
10
10
|
|
|
11
|
-
<Tab label="
|
|
11
|
+
<Tab label="esm">
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
13
|
+
```ts
|
|
14
|
+
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
|
|
15
15
|
|
|
16
16
|
new RsdoctorRspackPlugin({
|
|
17
17
|
/** RsdoctorRspackPluginOptions */
|
|
@@ -20,10 +20,10 @@ new RsdoctorRspackPlugin({
|
|
|
20
20
|
|
|
21
21
|
</Tab>
|
|
22
22
|
|
|
23
|
-
<Tab label="
|
|
23
|
+
<Tab label="cjs">
|
|
24
24
|
|
|
25
|
-
```
|
|
26
|
-
|
|
25
|
+
```js
|
|
26
|
+
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');
|
|
27
27
|
|
|
28
28
|
new RsdoctorRspackPlugin({
|
|
29
29
|
/** RsdoctorRspackPluginOptions */
|
|
@@ -36,16 +36,14 @@ new RsdoctorRspackPlugin({
|
|
|
36
36
|
|
|
37
37
|
## RsdoctorWebpackPlugin
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
import { Tab, Tabs } from '@theme';
|
|
39
|
+
The **RsdoctorWebpackPlugin** class is exported by `@rsdoctor/webpack-plugin`, and the configuration options are [RsdoctorWebpackPluginOptions](#rsdoctorwebpackpluginoptions).
|
|
42
40
|
|
|
43
41
|
<Tabs>
|
|
44
42
|
|
|
45
|
-
<Tab label="
|
|
43
|
+
<Tab label="esm">
|
|
46
44
|
|
|
47
|
-
```
|
|
48
|
-
|
|
45
|
+
```ts
|
|
46
|
+
import { RsdoctorWebpackPlugin } from '@rsdoctor/webpack-plugin';
|
|
49
47
|
|
|
50
48
|
new RsdoctorWebpackPlugin({
|
|
51
49
|
/** RsdoctorWebpackPluginOptions */
|
|
@@ -54,10 +52,10 @@ new RsdoctorWebpackPlugin({
|
|
|
54
52
|
|
|
55
53
|
</Tab>
|
|
56
54
|
|
|
57
|
-
<Tab label="
|
|
55
|
+
<Tab label="cjs">
|
|
58
56
|
|
|
59
|
-
```
|
|
60
|
-
|
|
57
|
+
```js
|
|
58
|
+
const { RsdoctorWebpackPlugin } = require('@rsdoctor/webpack-plugin');
|
|
61
59
|
|
|
62
60
|
new RsdoctorWebpackPlugin({
|
|
63
61
|
/** RsdoctorWebpackPluginOptions */
|
|
@@ -72,267 +70,64 @@ new RsdoctorWebpackPlugin({
|
|
|
72
70
|
|
|
73
71
|
**Type:** `Object`
|
|
74
72
|
|
|
75
|
-
This is the
|
|
76
|
-
|
|
77
|
-
- [brief](#brief)
|
|
78
|
-
- [disableClientServer](#disableclientserver)
|
|
79
|
-
- [experiments](#experiments)
|
|
80
|
-
- [features](#features)
|
|
81
|
-
- [mode](#mode)
|
|
82
|
-
- [output](#output)
|
|
83
|
-
- [port](#port)
|
|
84
|
-
- [supports](#supports)
|
|
85
|
-
|
|
86
|
-
### brief
|
|
87
|
-
|
|
88
|
-
<Badge text="Version: 0.4.0" type="warning" />
|
|
89
|
-
|
|
90
|
-
- **Type:** [BriefType](#brieftype)
|
|
91
|
-
- **Optional:** `true`
|
|
92
|
-
- **Default:** undefined
|
|
73
|
+
This `Options` object is the configuration for [RsdoctorRspackPlugin](#rsdoctorrspackplugin) and [RsdoctorWebpackPlugin](#rsdoctorwebpackplugin) . It contains the following properties:
|
|
93
74
|
|
|
94
|
-
|
|
75
|
+
- [disableClientServer](./disableClientServer.mdx) - **Client Service Control**: Whether to not automatically open the Rsdoctor report service after analysis is complete.
|
|
76
|
+
- [experiments](./experiments.mdx) - **Experimental Features Configuration**: Enable experimental features for Rspack plugins, such as native plugin performance optimization.
|
|
77
|
+
- [features](./features.mdx) - **Feature Toggle Configuration**: Control various analysis features of Rsdoctor, such as loader analysis, bundle analysis, rule checking, etc.
|
|
78
|
+
- [output](./output.mdx) - **Output Related Configuration**: Control report output format, directory and other options, including mode, options, reportCodeType, etc.
|
|
79
|
+
- [port](./port.mdx) - **Service Port Configuration**: Set the port number for the Rsdoctor development server, used for report preview during local development.
|
|
80
|
+
- [supports](./supports.mdx) - **Feature Support Configuration**: Enable compatibility support for specific build tools, such as BannerPlugin, etc.
|
|
81
|
+
- [brief](./brief.mdx) - **Brief Mode Configuration**: Control the generation of brief mode reports, including HTML filename and whether to generate JSON data files.
|
|
82
|
+
- [mode](./mode.mdx) - **Build Report Data Output Mode**: Select the output mode for reports, supporting normal (normal mode) and brief (brief mode).
|
|
95
83
|
|
|
96
|
-
|
|
97
|
-
- **writeDataJson:** By default, in Brief mode, the analysis data is injected into the HTML file, so no additional build analysis data is generated. If you want to generate additional local data, you need to configure `writeDataJson: true`.
|
|
98
|
-
|
|
99
|
-
#### briefType
|
|
84
|
+
### RsdoctorRspackPluginOptions
|
|
100
85
|
|
|
101
86
|
```ts
|
|
102
|
-
interface
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
### disableClientServer
|
|
109
|
-
|
|
110
|
-
- **Type:** `boolean`
|
|
111
|
-
- **Optional:** `true`
|
|
112
|
-
- **Default:** `false`
|
|
113
|
-
|
|
114
|
-
Whether to automatically open the Rsdoctor report page. If you do not need to view the analysis report provided by Rsdoctor in the browser, you can enable this configuration item.
|
|
115
|
-
|
|
116
|
-
### experiments
|
|
117
|
-
|
|
118
|
-
<Badge text="Version: 1.0.0" type="warning" />
|
|
119
|
-
|
|
120
|
-
#### enableNativePlugin
|
|
121
|
-
|
|
122
|
-
- Type: `boolean`
|
|
123
|
-
- Optional: true
|
|
124
|
-
- Default: false
|
|
125
|
-
|
|
126
|
-
##### Description
|
|
127
|
-
|
|
128
|
-
By integrating Rsdoctor's native plugin into Rspack, we move Rsdoctor's time-consuming data processing logic to the Rspack build stage. This feature significantly improves the build analysis efficiency of Rsdoctor in Rspack, reducing the overall analysis time.
|
|
129
|
-
|
|
130
|
-
- enableNativePlugin: Whether to enable the Rspack native plugin, enabling it can significantly reduce the analysis time of Rsdoctor itself.
|
|
131
|
-
|
|
132
|
-
- Example
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
new RsdoctorRspackPlugin({
|
|
136
|
-
experiments: { enableNativePlugin: true }
|
|
137
|
-
}),
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### features
|
|
141
|
-
|
|
142
|
-
- **Type:** [RsdoctorWebpackPluginFeatures](#rsdoctorwebpackpluginfeatures) | [Array\<keyof RsdoctorWebpackPluginFeatures\>](#rsdoctorwebpackpluginfeatures) | [RsdoctorRspackPluginFeatures](#rsdoctorrspackpluginfeatures) | [Array\<keyof RsdoctorRspackPluginFeatures\>](#rsdoctorrspackpluginfeatures)
|
|
143
|
-
- **Optional:** `true`
|
|
144
|
-
- **Default:** `['loader', 'plugins', 'bundle']`
|
|
145
|
-
|
|
146
|
-
#### features values
|
|
147
|
-
|
|
148
|
-
The `features` attribute is used to analyze the function switches, and the specific functional items are as follows:
|
|
149
|
-
|
|
150
|
-
- **loader**: Analysis of Loader time consumption and code compilation changes, enabled by default.
|
|
151
|
-
- **plugins**: Analysis of Plugins calls and time consumption, enabled by default.
|
|
152
|
-
- **bundle**: Analysis of build bundles, enabled by default.
|
|
153
|
-
- **resolver**: resolver analysis, disabled by default.
|
|
154
|
-
- **lite**: [**deprecated, please use [mode.lite](#mode)**]
|
|
155
|
-
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.
|
|
156
|
-
|
|
157
|
-
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.
|
|
158
|
-
|
|
159
|
-
:::tip
|
|
160
|
-
|
|
161
|
-
**If an "out of memory" error occurs, you can try the following:**
|
|
162
|
-
|
|
163
|
-
1. Open the **lite** mode.[mode.lite](#mode)
|
|
164
|
-
2. Increase the node memory limit, for example: NODE_OPTIONS=--max-old-space-size=8096.
|
|
165
|
-
|
|
166
|
-
- Reason: During the build process, source code information is cached, which exceeds memory. Therefore, enabling the **"lite" mode** can help alleviate the problem.
|
|
167
|
-
- Difference: The difference between the "lite" mode and the normal mode is that source code information is no longer cached, only packaged code information is cached. Thus, the code analyzed on the page will also only be packaged.
|
|
87
|
+
interface RsdoctorWebpackPluginOptions<
|
|
88
|
+
Rules extends LinterType.ExtendRuleData[],
|
|
89
|
+
> {
|
|
90
|
+
/** Linter configuration */
|
|
91
|
+
linter?: LinterType.Options<Rules, InternalRules>;
|
|
168
92
|
|
|
169
|
-
|
|
93
|
+
/** Rsdoctor feature toggles */
|
|
94
|
+
features?:
|
|
95
|
+
| Plugin.RsdoctorWebpackPluginFeatures
|
|
96
|
+
| Array<keyof Plugin.RsdoctorWebpackPluginFeatures>;
|
|
170
97
|
|
|
171
|
-
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Use `output.mode` instead. If using `lite` mode, please use `output.reportCodeType: 'noCode' or 'noAssetsAndModuleSource'` instead
|
|
100
|
+
* Rsdoctor mode options:
|
|
101
|
+
* - normal: Normal mode
|
|
102
|
+
* - brief: Brief mode, only displays duration analysis and build artifact analysis results, does not display any code parts
|
|
103
|
+
*/
|
|
104
|
+
mode?: 'brief' | 'normal' | 'lite';
|
|
172
105
|
|
|
173
|
-
|
|
174
|
-
- if the `features` is set as an `Object`, it will **close** the features which you set the value is `false`.
|
|
106
|
+
disableClientServer?: boolean;
|
|
175
107
|
|
|
176
|
-
|
|
108
|
+
supports?: ISupport;
|
|
177
109
|
|
|
178
|
-
|
|
110
|
+
port?: number;
|
|
179
111
|
|
|
180
|
-
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated Use `output.options.htmlOptions` instead
|
|
114
|
+
*/
|
|
115
|
+
brief?: Config.BriefConfig;
|
|
181
116
|
|
|
182
|
-
<
|
|
117
|
+
output?: Config.IOutput<'brief' | 'normal'>;
|
|
183
118
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
`features` type:
|
|
187
|
-
|
|
188
|
-
import FeaturesRspack from '@en/shared/features-rspack.md';
|
|
189
|
-
|
|
190
|
-
<FeaturesRspack />
|
|
191
|
-
|
|
192
|
-
### mode
|
|
193
|
-
|
|
194
|
-
<Badge text="Version: 0.4.0" type="warning" />
|
|
195
|
-
|
|
196
|
-
- **Type:** `normal | brief | lite`
|
|
197
|
-
- **Optional:** `true`
|
|
198
|
-
- **Default:** `normal`
|
|
199
|
-
|
|
200
|
-
Choose the Rsdoctor build report mode to use, which includes the following options:
|
|
201
|
-
|
|
202
|
-
import ModeIntro from '@en/shared/mode-intro.md';
|
|
203
|
-
|
|
204
|
-
<ModeIntro />
|
|
205
|
-
|
|
206
|
-
### output
|
|
207
|
-
|
|
208
|
-
<Badge text="Version 1.0.0" type="warning" />
|
|
209
|
-
|
|
210
|
-
#### compressData
|
|
211
|
-
|
|
212
|
-
- **Type:** boolean
|
|
213
|
-
- **Optional:** `true`
|
|
214
|
-
- **Default:** true
|
|
215
|
-
|
|
216
|
-
compressData is used to configure whether to compress the analysis data under [outputDir]/.rsdoctor.
|
|
217
|
-
|
|
218
|
-
#### reportDir
|
|
219
|
-
|
|
220
|
-
- **Type:** string
|
|
221
|
-
- **Optional:** `true`
|
|
222
|
-
- **Default:** undefined
|
|
223
|
-
|
|
224
|
-
The output directory for Rsdoctor reports. By default, it is the build output directory.
|
|
225
|
-
|
|
226
|
-
#### reportCodeType
|
|
227
|
-
|
|
228
|
-
- Type: `{ noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }`
|
|
229
|
-
- Optional: true
|
|
230
|
-
- Default: undefined
|
|
231
|
-
- Description
|
|
232
|
-
|
|
233
|
-
- Select the output analysis data:
|
|
234
|
-
|
|
235
|
-
- default is all complete data;
|
|
236
|
-
|
|
237
|
-
- noModuleSource: true is the output of data other than module code; Module code is the packaged module code of a file disassembled in the Bundle.
|
|
238
|
-
|
|
239
|
-
- noAssetsAndModuleSource: true is the output of data other than module code and Assets product code.
|
|
240
|
-
|
|
241
|
-
- Example
|
|
242
|
-
|
|
243
|
-
```js
|
|
244
|
-
new RsdoctorRspackPlugin({
|
|
245
|
-
reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
|
|
246
|
-
}),
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### port
|
|
250
|
-
|
|
251
|
-
- **Type:** `number`
|
|
252
|
-
- **Optional:** `true`
|
|
253
|
-
- **Default:** `random(3000, 8999)`
|
|
254
|
-
|
|
255
|
-
Configure the port for the Rsdoctor server.
|
|
256
|
-
|
|
257
|
-
### ~~reportCodeType [**Deprecated**]~~
|
|
258
|
-
|
|
259
|
-
<Badge text="Deprecated" type="warning" />
|
|
260
|
-
|
|
261
|
-
Please use [output.reportCodeType](#reportcodetype)
|
|
262
|
-
|
|
263
|
-
### ~~reportDir [**Deprecated**]~~
|
|
264
|
-
|
|
265
|
-
<Badge text="Deprecated" type="warning" />
|
|
266
|
-
|
|
267
|
-
Please use [output.reportDir](#reportDir)
|
|
268
|
-
|
|
269
|
-
### supports
|
|
270
|
-
|
|
271
|
-
- **Type:** [Supports Types](#supports-types)
|
|
272
|
-
- **Optional:** `true`
|
|
273
|
-
- **Default:** `undefined`
|
|
274
|
-
|
|
275
|
-
This option is used to configure whether Rsdoctor enables support for certain detailed feature analysis capabilities, such as whether to enable compatibility with BannerPlugin.
|
|
276
|
-
|
|
277
|
-
#### Supports types
|
|
119
|
+
experiments?: RsdoctorRspackPluginExperiments;
|
|
120
|
+
}
|
|
278
121
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
122
|
+
interface RsdoctorRspackPluginExperiments {
|
|
123
|
+
/**
|
|
124
|
+
* Whether to enable native plugin to improve performance
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
enableNativePlugin?: boolean;
|
|
128
|
+
}
|
|
285
129
|
```
|
|
286
130
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
:::danger
|
|
290
|
-
`supports.banner` option is only used for debugging, do not use it in production.
|
|
291
|
-
:::
|
|
292
|
-
|
|
293
|
-
- default: false.
|
|
294
|
-
- type: boolean.
|
|
295
|
-
|
|
296
|
-
If `supports.banner` is enabled, Rsdoctor will enable compatibility logic for BannerPlugin. For more details, please refer to: [Supports BannerPlugin](../../guide/usage/bundle-size#supports-bannerplugin)
|
|
297
|
-
|
|
298
|
-
#### ~~generateTileGraph [**Deprecated**]~~
|
|
299
|
-
|
|
300
|
-
<Badge text="Deprecated" type="warning" />
|
|
301
|
-
|
|
302
|
-
Rsdoctor supports generating Tree Map graphs by default, so this option does not need to be configured.
|
|
303
|
-
|
|
304
|
-
#### parseBundle
|
|
305
|
-
|
|
306
|
-
- default: true.
|
|
307
|
-
- type: boolean.
|
|
308
|
-
|
|
309
|
-
In some large repositories, the execution time of parsing the bundle is too long. Since the Parse Bundle analysis utilizes AST parsing and processing, it can be time-consuming when there are a large number of output files.
|
|
310
|
-
If this capability is not necessary, it can be selectively disabled using the supports.parseBundle configuration. An example is shown below:
|
|
311
|
-
|
|
312
|
-
```ts
|
|
313
|
-
chain.plugin('Rsdoctor').use(RsdoctorRspackPlugin, [
|
|
314
|
-
{
|
|
315
|
-
supports: {
|
|
316
|
-
parseBundle: false,
|
|
317
|
-
},
|
|
318
|
-
},
|
|
319
|
-
]);
|
|
320
|
-
```
|
|
131
|
+
### RsdoctorWebpackPluginOptions
|
|
321
132
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<div style={{ display: 'flex' }}>
|
|
325
|
-
<img
|
|
326
|
-
src="https://assets.rspack.rs/others/assets/rsdoctor/bundled-size.jpeg"
|
|
327
|
-
height="300px"
|
|
328
|
-
width="300px"
|
|
329
|
-
style={{ margin: 'auto' }}
|
|
330
|
-
/>
|
|
331
|
-
|
|
332
|
-
<img
|
|
333
|
-
src="https://assets.rspack.rs/others/assets/rsdoctor/bundled-code.png"
|
|
334
|
-
height="300px"
|
|
335
|
-
width="400px"
|
|
336
|
-
style={{ margin: 'auto' }}
|
|
337
|
-
/>
|
|
338
|
-
</div>
|
|
133
|
+
RsdoctorWebpackPlugin is equivalent to `Omit<RsdoctorRspackPluginOptions, 'experiments'>` type.
|