For AI agents: the complete documentation index is available at https://rsdoctor.rs/llms.txt, the full documentation bundle is available at https://rsdoctor.rs/llms-full.txt, and this page is available as Markdown at https://rsdoctor.rs/config/options/features.md.
close
  • English
  • 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.
    • treeShaking: Tree-shaking side-effect analysis, disabled by default. This feature is unavailable when output.mode is 'brief'.
    • lite: Enables lite mode. Both features: { lite: true } and features: ['lite'] are supported. When enabled, lite mode forces the report code type to noAssetsAndModuleSource, overriding other output.reportCodeType values. The only exception is an explicitly configured noCode value, which takes precedence. noAssetsAndModuleSource omits module source and asset code while retaining bundled module code. Lite mode is disabled by default.

    By default, loader, plugins, and bundle are enabled; resolver, treeShaking, and lite are disabled.

    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 an object, omitted features keep their defaults. Set a feature to true to enable it or false to disable it.

    Examples

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

    Notes

    Tip

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

    1. Set output.reportCodeType to noCode or noAssetsAndModuleSource.
    2. Increase the node memory limit, for example: NODE_OPTIONS=--max-old-space-size=8096.
    • Reason: The build may exceed the memory limit when it stores source code. Reducing the code data included in the report can lower memory usage.
    • Difference: noCode omits all code, while noAssetsAndModuleSource omits asset code and module source code.

    RsdoctorRspackPluginFeatures

    features type:

    interface RsdoctorRspackPluginFeatures {
      /**
       * turn off it if you need not to analyze the executions of Rspack loaders.
       * @default true
       */
      loader?: boolean;
      /**
       * turn off it if you need not to analyze the executions of Rspack plugins.
       * @default true
       */
      plugins?: boolean;
      /**
       * turn on it if you need to analyze resolver executions.
       * @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 need to analyze the tree shaking result.
       * @default false
       */
      treeShaking?: boolean;
      /**
       * Enable this if you only use lite mode. Source code is not included.
       * @default false
       */
      lite?: boolean;
    }