Build config
Rspress uses Rsbuild to build your documentation site. Use builderConfig to customize the build, for example by setting path aliases or adding Rsbuild plugins. Use builderConfig.tools.rspack to adjust the underlying Rspack configuration directly.
builderConfig
- Type:
RsbuildConfig - Default:
undefined(uses Rspress's built-in Rsbuild config)
Customizes the Rsbuild configuration. For details, see Rsbuild - Config.
- Example: Use resolve.alias to configure path aliases:
- Example: Use tools.rspack to modify the Rspack configuration, such as registering a webpack or Rspack plugin:
To modify the output directory, use outDir.
builderConfig.plugins
- Type:
RsbuildPlugin[] - Default:
undefined(no additional plugins)
To register Rsbuild plugins.
You can leverage Rsbuild's extensive plugin ecosystem to enhance and extend your build capabilities.
- Example: Support Vue SFCs with @rsbuild/plugin-vue
- Example: Add Google Analytics with rsbuild-plugin-google-analytics.
- Example: Add Open Graph meta tags with rsbuild-plugin-open-graph.
You can also override the built-in plugin @rsbuild/plugin-react and customize the plugin options.
For example:
Default config
To inspect the default Rspack or Rsbuild config, set DEBUG=rsbuild when running rspress dev or rspress build:
After the command runs, Rspress creates rsbuild.config.js in the doc_build directory. The file contains the complete builderConfig.
See Rsbuild - Debug Mode for more information about debugging Rsbuild.