• English
  • lib

    The rs lib command uses Rslib to build library outputs.

    Usage

    rs lib [command] [options]

    The command loads the library configuration registered with define.lib(). When no subcommand is provided, it builds the library.

    Options

    rs lib supports the same library build options as Rslib. See the Rslib CLI documentation for details.

    Examples:

    # Build and generate declaration files
    rs lib --dts
    
    # Rebuild when files change
    rs lib --watch

    Subcommands

    inspect

    rs lib inspect generates the normalized Rslib configuration and the corresponding Rsbuild and Rspack configurations for inspection.

    rs lib inspect

    mf-dev

    rs lib mf-dev starts an Rsbuild development server for a library output that uses the Module Federation (mf) format. Use it to develop and debug the module in a host application.

    rs lib mf-dev

    Configuration

    Configure library builds through define.lib() in the Rstack configuration file. It accepts the standard Rslib configuration:

    rstack.config.ts
    import { define } from 'rstack';
    
    define.lib({
      lib: [
        {
          dts: true,
          format: 'esm',
        },
      ],
    });