Overview
The lib field is an optional array of objects used to describe the library outputs generated by Rslib. Each lib item corresponds to one output and can contain lib configurations and Rsbuild configurations, as detailed in Configure Rslib.
- Type:
LibConfig[](seeRslibConfig) - Default:
[{}] - Required:
false
If the lib field is omitted, Rslib uses a default configuration equivalent to lib: [{}] to generate a single ESM output; if the lib field is explicitly configured, it must be a non-empty array.
For example, the following configuration will generate ESM and CJS outputs:
Shared lib configurations
The following lib configurations can be placed outside the lib field as shared configuration for all outputs or inside a lib item to configure a specific output:
Non-shared lib configurations
The following lib configurations do not support shared configuration and can only be specified in a lib item to configure an individual output:
