Options

RsdoctorRspackPlugin

RsdoctorRspackPlugin class are exported by @rsdoctor/rspack-plugin, and the option is RsdoctorRspackPluginOptions.

cjs
esm
const { RsdoctorRspackPlugin } = require('@rsdoctor/rspack-plugin');

new RsdoctorRspackPlugin({
  /** RsdoctorRspackPluginOptions */
});

RsdoctorWebpackPlugin

RsdoctorWebpackPlugin class are exported by @rsdoctor/webpack-plugin, and the option is RsdoctorWebpackPluginOptions.

cjs
esm
const { RsdoctorWebpackPlugin } = require('@rsdoctor/webpack-plugin');

new RsdoctorWebpackPlugin({
  /** RsdoctorWebpackPluginOptions */
});

Options

Type: Object

This is the options for the RsdoctorWebpackPlugin and RsdoctorRspackPlugin. It contains these properties:

disableClientServer

  • Type: boolean
  • Optional: true
  • Default: false

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.

features

features values

TIP

If an "out of memory" error occurs, you can try the following:

  1. Open the lite mode。
  2. Increase the node memory limit, for example: NODE_OPTIONS=--max-old-space-size=8096.
  • Reason: During the build process, source code information is cached, which exceeds memory. Therefore, enabling the "lite" mode can help alleviate the problem.
  • 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.

The features attribute is used to analyze the function switches, and the specific functional items are as follows:

  • loader: Analysis of Loader time consumption and code compilation changes, enabled by default.
  • plugins: Analysis of Plugins calls and time consumption, enabled by default.
  • bundle: Analysis of build artifacts, enabled by default.
  • resolver: resolver analysis, disabled by default.
  • lite: 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.

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.

features types

  • if the features is set as an Array, it will open the features which you define in this array only.
  • if the features is set as an Object, it will close the features which you set the value is false.

reportCodeType 参数

  • Type: { noModuleSource?: boolean; noAssetsAndModuleSource?: boolean }

  • Optional: true

  • Default: undefined

  • Description

    • 选择输出的分析数据:

      • undefined 是所有完整数据;
      • noModuleSource: true 是输出除了 module 代码之外的数据;Module 代码即 Bundle 内拆解出来的一个一个文件的打包模块代码。
      • noAssetsAndModuleSource: true 是输出除了 module 代码和 Assets 产物代码之外的数据。
    • Select the output analysis data:

      • undefined is all complete data;

      • 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.

      • noAssetsAndModuleSource: true is the output of data other than module code and Assets product code.

  • Example

new WebDoctorWebpackPlugin({
        disableClientServer: false, // 建议 CI 环境下关闭 server 能力,否则会卡住 pipeline 流程,检测 CI 环境可以使用 `process.env.CI_ACTOR`.
        features: ['loader', 'bundle', 'plugins'],
        reportCodeType: { noModuleSource: true } // { noAssetsAndModuleSource: true }
      }),

disableTOSUpload

  • Type: boolean

  • Optional: true

  • Default: false

  • Description

    开启或关闭需要 tos 上传, true 是关闭 tos 上传,false 是开启 tos 上传。

    Turn tos upload on or off. True is to turn off tos upload, and false is tos upload on.

  • Example

new WebDoctorWebpackPlugin({
        disableClientServer: false, // 建议 CI 环境下关闭 server 能力,否则会卡住 pipeline 流程,检测 CI 环境可以使用 `process.env.CI_ACTOR`.
        features: ['loader', 'bundle', 'plugins'],
        disableTOSUpload: true,
      }),