Describe the feature
unplugin@3.0.0 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:
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
Describe the feature
unplugin@3.0.0provides 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).rsbuildRsbuild 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/rsbuildentrypoint 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/vitemy-plugin/webpackmy-plugin/rollupmy-plugin/esbuildmy-plugin/rspackbut not a native:
my-plugin/rsbuildA first-class Rsbuild adapter would make Rsbuild support consistent with the rest of the supported build tools.
Proposed API
And through
createUnplugin:Expected Usage
Current Workaround
Today, Rsbuild users can often route the Rspack adapter manually through
tools.rspack: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