For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /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.
    • 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.

    Therefore, the default configuration enables Bundle analysis capabilities, Loader and Plugin build-time analysis. Resolver analysis is not enabled by default. To enable it, explicitly configure resolver in features.

    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. 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;
      /**
       * turn on it if you just use lite mode. This mode do not have source codes.
       * @default false
       * @deprecated
       */
      lite?: boolean;
    }