close

Overview

RsdoctorRspackPlugin

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

esm
cjs
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';

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

RsdoctorWebpackPlugin

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

esm
cjs
import { RsdoctorWebpackPlugin } from '@rsdoctor/webpack-plugin';

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

Options

Type: Object

This Options object is the configuration for RsdoctorRspackPlugin and RsdoctorWebpackPlugin . It contains the following properties:

  • disableClientServer - Client Service Control: Whether to not automatically open the Rsdoctor report service after analysis is complete.
  • experiments - Experimental Features Configuration: Enable experimental features for Rspack plugins, such as native plugin performance optimization.
  • features - Feature Toggle Configuration: Control various analysis features of Rsdoctor, such as loader analysis, bundle analysis, rule checking, etc.
  • output - Output Related Configuration: Control report output format, directory and other options, including mode, options, reportCodeType, etc.
  • port - Service Port Configuration: Set the port number for the Rsdoctor development server, used for report preview during local development.
  • supports - Feature Support Configuration: Enable compatibility support for specific build tools, such as BannerPlugin, etc.
  • brief - Brief Mode Configuration: Control the generation of brief mode reports, including HTML filename and whether to generate JSON data files.
  • mode - Build Report Data Output Mode: Select the output mode for reports, supporting normal (normal mode) and brief (brief mode).

RsdoctorRspackPluginOptions

interface RsdoctorWebpackPluginOptions<
  Rules extends LinterType.ExtendRuleData[],
> {
  /** Linter configuration */
  linter?: LinterType.Options<Rules, InternalRules>;

  /** Rsdoctor feature toggles */
  features?:
    | Plugin.RsdoctorWebpackPluginFeatures
    | Array<keyof Plugin.RsdoctorWebpackPluginFeatures>;

  /**
   * @deprecated Use `output.mode` instead. If using `lite` mode, please use `output.reportCodeType: 'noCode' or 'noAssetsAndModuleSource'` instead
   * Rsdoctor mode options:
   * - normal: Normal mode
   * - brief: Brief mode, only displays duration analysis and build artifact analysis results, does not display any code parts
   */
  mode?: 'brief' | 'normal' | 'lite';

  disableClientServer?: boolean;

  supports?: ISupport;

  port?: number;

  /**
   * @deprecated Use `output.options.htmlOptions` instead
   */
  brief?: Config.BriefConfig;

  output?: Config.IOutput<'brief' | 'normal'>;

  experiments?: RsdoctorRspackPluginExperiments;
}

interface RsdoctorRspackPluginExperiments {
  /**
   * Whether to enable native plugin to improve performance
   * @default true
   */
  enableNativePlugin?: boolean;
}

RsdoctorWebpackPluginOptions

RsdoctorWebpackPlugin is equivalent to Omit<RsdoctorRspackPluginOptions, 'experiments'> type.