Improve build performance
While Rsbuild optimizes build performance by default, performance issues can arise as your project grows.
This document provides optional optimization strategies to improve build performance.
Performance profiling
Performance profiling helps identify bottlenecks in your project for targeted optimization.
See the Build Performance Analysis section.
General optimization
These general optimization methods speed up both development and production builds.
Upgrade Rsbuild
Upgrading to the latest version of Rsbuild gives you access to the latest performance optimizations. See Upgrade Rsbuild for more details.
Enable persistent cache
Rsbuild provides a performance.buildCache configuration that significantly improves rebuild speed.
Reduce module count
Optimizing the number of modules in your application reduces bundle size and improves build performance. See Bundle Size Optimization to learn optimization strategies.
Optimize Tailwind CSS
When using Tailwind CSS v3, incorrectly configuring the content field in tailwind.config.js can lead to poor build and HMR performance.
See Tailwind CSS v3 - Optimize build performance for more details.
Parallel Less compilation
If your project uses the @rsbuild/plugin-less plugin with many Less files, try enabling parallel compilation to improve build performance.
See Less Plugin - parallel for more details.
Tool selection
While Rsbuild delivers excellent build performance out of the box, certain JavaScript-based tools can negatively impact performance, particularly in large projects.
- @rsbuild/plugin-babel: This plugin uses Babel. We recommend using the more performant SWC for code transformation instead.
- @rsbuild/plugin-less: The Less compiler has relatively poor performance. Consider using @rsbuild/plugin-sass or other performant CSS solutions instead.
- terser-webpack-plugin: You can replace Terser with faster minimizers like Rsbuild's built-in SWC minifier.
Development optimization
These methods improve performance in development mode.
Enable lazy compilation
Enabling lazy compilation significantly reduces the number of modules compiled during dev server startup, improving startup time.
See dev.lazyCompilation for more information.
Enable native watcher
Enabling Rspack's native watcher improves HMR performance in development mode.
Source map format
To provide a good debugging experience, Rsbuild uses the cheap-module-source-map format in development mode by default. This is a high-quality source map format that comes with some performance overhead.
You can improve build speed by adjusting the source map format using output.sourceMap.
For example, to disable source maps:
Or set the source map format to the fastest eval format in development mode:
For detailed differences between different source map formats, see Rspack - devtool.
Browserslist for development
This strategy is similar to "Adjust Browserslist", except you can set different browserslist configurations for development and production, reducing compilation overhead in development.
For example, you can add the following config to .browserslistrc to target only the latest browsers in development while supporting a broader range in production:
Note that this can lead to differences in build output between development and production modes.

