Skip to content

Latest commit

 

History

History
121 lines (81 loc) · 2.66 KB

File metadata and controls

121 lines (81 loc) · 2.66 KB
description Reference the TypeScript types exported by Rslib for configs, APIs, instance methods, plugins, and Rsbuild or Rspack types.

Rslib types

This section describes some of the type definitions provided by the Rslib.

RslibInstance

The type of Rslib instance, corresponding to the return value of the createRslib method.

import type { RslibInstance } from '@rslib/core';

let rslib: RslibInstance;

RslibConfig

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';

RsbuildPlugin

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() {},
};

CreateRslibOptions

The param type of createRslib method.

import type { CreateRslibOptions } from '@rslib/core';

BuildOptions

The param type of rslib.build method.

import type { BuildOptions } from '@rslib/core';

StartMFDevServerOptions

The param type of rslib.startMFDevServer method.

import type { StartMFDevServerOptions } from '@rslib/core';

InspectConfigOptions

The param type of rslib.inspectConfig method.

import type { InspectConfigOptions } from '@rslib/core';

Rspack

Includes all types exported by @rspack/core, such as Rspack.Configuration.

import type { Rspack } from '@rslib/core';

const rspackConfig: Rspack.Configuration = {};

Rsbuild

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 = {};

Others

See @rslib/core - src/index.ts for all exported types.