Home > @lynx-js/rspeedy > CreateRspeedyOptions > callerName

CreateRspeedyOptions.callerName property

The name of the framework or tool that is currently invoking Rsbuild. This allows plugins to tailor their behavior based on the calling context.

Signature:

callerName?: string;

Example

Rsbuild plugins can access this value via api.context.callerName.

export function myPlugin() {
  return {
    name: 'my-plugin',
    setup(api) {
      // Log the name of the tool invoking Rsbuild
      console.log(`Called by: ${api.context.callerName}`);

      // Conditionally apply plugin logic based on caller
      if (api.context.callerName === 'rspeedy') {
        api.modifyRsbuildConfig((config) => {
          // Apply rspeedy-specific config changes
          return config;
        });
      } else if (api.context.callerName === 'rslib') {
        api.modifyRsbuildConfig((config) => {
          // Apply rslib-specific config changes
          return config;
        });
      }
    }
  };
}