Used to register Rsbuild plugins.
Async plugin (promise) in the plugins array will be resolved, and falsy values will be ignored.
undefined
Please check out the Plugin List page to discover all available plugins.
For example, register the Stylus plugin in Rsbuild.
By default, plugins are executed in the order they appear in the plugins
array. Built-in Rsbuild plugins are executed before user-registered plugins.
When a plugin internally uses fields that control the order, such as pre
and post
, the execution order is adjusted based on them. See Pre Plugins for more details.
If your local code repository contains Rsbuild plugins, you can import them using relative paths.
If a plugin provides custom options, you can pass the configurations through the plugin function's parameters.
The plugins
option is used to register Rsbuild plugins. If you need to register Rspack or Webpack plugins, please use tools.rspack.
unplugin is a unified plugin system for various build tools. You can use plugins implemented based on unplugin in Rsbuild, just import the /rspack
subpath of the plugin and register it via tools.rspack.
Here is an example of using unplugin-vue-components:
When using the transform hook in unplugin, please use the transformInclude
hook to match the specified module. When the transform hook matches the .html
module, it will replace the default EJS transformation of the html-rspack-plugin.
Please ensure that the version of
unplugin
package is >= v1.6.0.