close

features

Configuration Description

The features attribute is used for analysis feature toggles, and the specific functional items are as follows:

  • loader: Loader time consumption and code compilation change analysis, enabled by default.
  • plugins: Plugin calls and time consumption analysis, enabled by default.
  • bundle: Build artifact analysis, enabled by default.
  • resolver: Resolver analysis, disabled by default.
  • lite: (lite mode will be deprecated in V2, refer to lite mode deprecation notice) 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.

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.

Types

  • If you set features as an array type, the plugin will only enable the features you define in the features array.
  • If you set features as a simple object type, the plugin will only disable the features you set to false in the features object.

Examples

new RsdoctorRspackPlugin({
  // Only enable bundle, loader, plugins feature analysis, array form will override default configuration.
  features: ['bundle', 'loader', 'plugins'],
});
new RsdoctorRspackPlugin({
  features: {
    // Disable bundle analysis, other feature analysis remains default
    bundle: false,
  },
});

Notes

Tip

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

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

RsdoctorWebpackPluginFeatures

features type:

interface RsdoctorWebpackPluginFeatures {
  /**
   * turn off it if you need not to analyze the executions of webpack loaders.
   * @default true
   */
  loader?: boolean;
  /**
   * turn off it if you need not to analyze the executions of webpack plugins.
   * @default true
   */
  plugins?: boolean;
  /**
   * turn off it if you need not to analyze the executions of resolver.
   * @default false
   */
  resolver?: boolean;
  /**
   * turn off it if you need not to analyze the output bundle.
   * @default true
   */
  bundle?: boolean;
  /**
   * turn on it if you just use lite mode. This mode do not have source codes.
   * @default false
   * @deprecated
   */
  lite?: boolean;
}

RsdoctorRspackPluginFeatures

features type:

interface RsdoctorRspackPluginFeatures {
  /**
   * turn off it if you need not to analyze the executions of webpack loaders.
   * @default true
   */
  loader?: boolean;
  /**
   * turn off it if you need not to analyze the executions of webpack plugins.
   * @default true
   */
  plugins?: boolean;
  /**
   * turn off it if you need not to analyze the output bundle.
   * @default true
   */
  bundle?: boolean;
  /**
   * turn on it if you just use lite mode. This mode do not have source codes.
   * @default false
   * @deprecated
   */
  lite?: boolean;
}