Skip to content

feat: add first-class Rsbuild adapter #607

Closed

Description

@yslpn

Describe the feature

[email protected] provides first-class adapters for Vite, Webpack, Rollup, esbuild, and Rspack, but it does not currently expose a first-class Rsbuild adapter.

Specifically, there is no:

  • createRsbuildPlugin(factory)
  • createUnplugin(factory).rsbuild

Rsbuild is built on top of Rspack, so many unplugin-based transforms can work in an Rsbuild project through a manual Rspack configuration workaround. However, package authors cannot expose a clean my-plugin/rsbuild entrypoint with the same ergonomics as existing adapters.

Motivation

Rsbuild users currently need to wire unplugin-based Rspack plugins through tools.rspack, which is less discoverable and less consistent than the existing adapter model.

For plugin authors, this also means packages can expose:

  • my-plugin/vite
  • my-plugin/webpack
  • my-plugin/rollup
  • my-plugin/esbuild
  • my-plugin/rspack

but not a native:

  • my-plugin/rsbuild

A first-class Rsbuild adapter would make Rsbuild support consistent with the rest of the supported build tools.

Proposed API

import {createRsbuildPlugin} from 'unplugin'
import {unpluginFactory} from './index.js'

export default createRsbuildPlugin(unpluginFactory)

And through createUnplugin:

import {createUnplugin} from 'unplugin'

const plugin = createUnplugin(factory)

export default plugin.rsbuild

Expected Usage

// rsbuild.config.ts
import {defineConfig} from '@rsbuild/core'
import myPlugin from 'my-plugin/rsbuild'

export default defineConfig({
  plugins: [
    myPlugin({
      /* plugin options */
    }),
  ],
})

Current Workaround

Today, Rsbuild users can often route the Rspack adapter manually through tools.rspack:

// rsbuild.config.ts
import {defineConfig} from '@rsbuild/core'
import myPlugin from 'my-plugin/rspack'

export default defineConfig({
  tools: {
    rspack(config) {
      config.plugins ??= []
      config.plugins.push(myPlugin())
    },
  },
})

This works for some plugins, but it is not as ergonomic or discoverable as a native Rsbuild plugin. It also requires users to know that Rsbuild is Rspack-based and that the Rspack adapter can be manually inserted into the generated Rspack config.

Additional information

  • Would you be willing to help implement this feature?

Activity

  1. added
    enhancement
    on Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions