plugins pluginsplugins

plugins is used to register Rsbuild plugins.

Rslib and Rsbuild share the same plugin system, so you can use Rsbuild plugins in Rslib.

TIP

Currently, some plugins have not been adapted to the bundleless mode of Rslib, such as the Vue plugin and Svelte plugin. Therefore, these plugins can only be used in the bundle mode.

Using plugins

You can register Rsbuild plugins in rslib.config.* using the plugins option, see Rsbuild - plugins.

rslib.config.ts
import { defineConfig } from '@rslib/core';
import { pluginReact } from '@rsbuild/plugin-react';

export default defineConfig({
  plugins: [pluginReact()],
});

Official plugins

The following are official plugins that can be used in Rsbuild, and applicable to Rslib.

For React

Plugins available for React:

For Vue

Plugins available for Vue:

  • Vue Plugin: Provides support for Vue 3 SFC (Single File Components).
  • Vue JSX Plugin: Provides support for Vue 3 JSX / TSX syntax.
  • Vue2 Plugin: Provides support for Vue 2 SFC (Single File Components).
  • Vue2 JSX Plugin: Provides support for Vue 2 JSX / TSX syntax.

For Preact

Plugins available for Preact:

For Svelte

Plugins available for Svelte:

  • Svelte Plugin: Provides support for Svelte components (.svelte files).

For Solid

Plugins available for Solid:

Common

The following are common framework-agnostic plugins:

TIP

You can find the source code of all official plugins in web-infra-dev/rsbuild and rspack-contrib.

Community plugins

You can check out the Rsbuild plugins provided by the community at awesome-rspack - Rsbuild Plugins.

You can also discover more Rsbuild plugins on npm by searching for the keyword rsbuild-plugin.