| description | Reference the TypeScript types exported by Rslib for configs, APIs, instance methods, plugins, and Rsbuild or Rspack types. |
|---|
This section describes some of the type definitions provided by the Rslib.
The type of Rslib instance, corresponding to the return value of the createRslib method.
import type { RslibInstance } from '@rslib/core';
let rslib: RslibInstance;The type of Rslib configuration.
import type { RslibConfig } from '@rslib/core';
const config: RslibConfig = {
lib: [
{
format: 'esm',
},
],
};You can also import the type definitions of each field in the Rslib config:
import type {
AutoExternal,
BannerAndFooter,
Dts,
Format,
LibConfig,
Redirect,
Shims,
Syntax,
} from '@rslib/core';Defines the structure and behavior of an Rsbuild plugin.
Rsbuild plugins provide a standardized way to extend build functionality through lifecycle hooks and configuration modifications.
import type { RsbuildPlugin } from '@rslib/core';
const myPlugin: RsbuildPlugin = {
name: 'my-plugin',
setup() {},
};The param type of createRslib method.
import type { CreateRslibOptions } from '@rslib/core';The param type of rslib.build method.
import type { BuildOptions } from '@rslib/core';The param type of rslib.startMFDevServer method.
import type { StartMFDevServerOptions } from '@rslib/core';The param type of rslib.inspectConfig method.
import type { InspectConfigOptions } from '@rslib/core';Includes all types exported by @rspack/core, such as Rspack.Configuration.
import type { Rspack } from '@rslib/core';
const rspackConfig: Rspack.Configuration = {};Includes all types exported by @rsbuild/core, such as Rsbuild.ToolsConfig.
See @rsbuild/core - src/index.ts for all exported types of Rsbuild.
import type { Rsbuild } from '@rslib/core';
const rsbuildConfig: Rsbuild.ToolsConfig = {};See @rslib/core - src/index.ts for all exported types.