March 19, 2024
Rsbuild 0.5 is an important milestone. As of this release, most of the Rsbuild API has reached a stable state and we expect to release Rsbuild 1.0 in Q3 2024.
Main changes:
Lightning CSS is a high performance CSS parser, transformer and minifier written in Rust. It supports parsing and transforming many modern CSS features into syntax supported by target browsers, and also provides a better compression ratio.
Rsbuild provides the Lightning CSS plugin to use Lightning CSS on an opt-in basis, replacing the built-in PostCSS, autoprefixer, and SWC CSS minimizer in Rsbuild.
All you need to do is register the Lightning CSS plugin in the Rsbuild configuration to complete the switch:
In a real large-scale web application, we have integrated the Rsbuild Lightning CSS plugin and used Rsdoctor to analyze the changes in build time:
Rsbuild now supports replacing the dev server with a custom server that reuses Rsbuild's page preview, routing, and module hot update features. This makes it easier to integrate Rsbuild with other Node.js frameworks.
For example, you can implement a custom server based on express:
For more details, please refer to Rsbuild - createDevServer.
In versions prior to 0.5.0, the default usage of the SVGR plugin was the same as create-react-app, allowing SVGs to be used via mixed import:
However, there are two problems with this approach:
So we have refactored the @rsbuild/plugin-svgr
plugin to support converting SVGs to React components via the ?react
query. This approach can solve the problems mentioned above, and is more in line with community best practices.
The SVGR plugin now supports switching between different SVGR usages. If a project needs to use the previous mixed import usage, you can manually enable the mixedImport option:
The output.disableMinimize
option has been renamed to output.minify, and it allows customizing JS and HTML minification options.
Projects using output.disableMinimize
can refer to the example below:
For more information, please refer to: