Features

Here are all the main features supported by Rsbuild.

JavaScript

FeaturesDescriptionLinks
RspackUse Rspack as the bundler by default
SWC compilationTransform and minify JavaScript and TypeScript code with SWC by default
TS compilationTS files are compiled by SWC by default
Code minificationCode minification is enabled by default in production mode
Polyfill injectionOptional feature, inject core-js and other polyfills
SourceMap generationSource maps are generated in development mode by default
AliasOptional feature, set import alias
Babel compilationOptional feature, use Babel to transform JavaScript and TypeScript code
Node outputsOptional feature, building bundles that run in Node.js environment
Web WorkersOptional feature, use Web Workers
BrowserslistOptional feature, using browserslist (opens new window) to specify which browsers should be supported in your web application.
Compatibility checkOptional feature, analyze if there are incompatible advanced syntax in the outputs within the current browser scope
Environment variableOptional feature, inject environment variables or expressions into the code
Node polyfillOptional feature, inject polyfills for Node core modules on the browser side
Type checkOptional feature, run type checker to check for type issues in code
Module FederationOptional feature, dynamically load modules and share dependencies

CSS

FeaturesDescriptionLinks
Lightning CSSUse Lightning CSS to downgrade CSS syntax by default
PostCSS transformationOptional feature, use PostCSS to transform CSS files
Tailwind CSSOptional feature, use Tailwind CSS
UnoCSSOptional feature, use UnoCSS
Sass preprocessingOptional feature, compile Sass/Scss files
Less preprocessingOptional feature, compile Less files
Stylus preprocessingOptional feature, compile Stylus files
CSS Modules compilationSupport compiling *.module.* files by default
CSS Modules typeOptional feature, generate type definition for CSS Modules
CSS minificationCSS minification is enabled by default in production build
Inline CSS into JSOptional feature, inline CSS files to JavaScript files

HTML

FeaturesDescriptionLinks
Set titleSet HTML <title> tag
Set metaSet HTML <meta> tag
Set faviconSet favicon
Set app iconSet web application icons
EJS template engineOptional feature, use EJS template engine
Pug template engineOptional feature, use pug template engine
Inline JS filesOptional feature, inline JS files into HTML
Inline CSS filesOptional feature, inline CSS files into HTML

Server

FeaturesDescriptionLinks
Public dirUse the public directory as the directory for serving public assets by default
SSROptional feature, implement server-side rendering
ProxyOptional feature, proxy requests to the specified service
Open pageOptional feature, automatically open page in browser when starting server
HTTPSOptional feature, enable HTTPS server
Custom middlewareOptional feature, use custom middlewares

UI framework

FeaturesDescriptionLinks
ReactOptional feature, enable compilation of React JSX
React RefreshOptional feature, enable React Refresh
SVGROptional feature, transform SVG to React component
Vue 3 SFCOptional feature, enable compilation of Vue 3 SFC (Single File Components)
Vue 3 JSXOptional feature, enable compilation of Vue 3 JSX syntax
Vue 2 SFCOptional feature, enable compilation of Vue 2 SFC (Single File Components)
Vue 2 JSXOptional feature, enable compilation of Vue 2 JSX syntax
SvelteOptional feature, enable compilation of Svelte component
SolidOptional feature, enable compilation of Solid JSX

Static assets

FeaturesDescriptionLinks
Import image assetsSupport for import image assets in code
Import font assetsSupport for import font assets in code
Import video assetsSupport for import video assets in code
Import Wasm assetsSupport for import WebAssembly assets in code
Import node addonsSupport for import Node.js addons in code
Inline static assetsSmall assets are inlined into JS by default
Clean up static assetsAutomatically clean up static assets in the dist directory before each build
Copy static assetsOptional feature, copy static assets to the dist directory
Generate manifest fileOptional feature, generate manifest.json file

Performance and debugging

FeaturesDescriptionLinks
Chunk splittingA variety of chunk splitting strategies are built into Rsbuild to automatically split the bundle into files of moderate size
Print file sizeAfter the production build, All bundle sizes is displayed by default
Analyze build processOptional feature, use Rsdoctor to analyze build process
Analyze bundle sizeOptional feature, analyze bundle size through Bundle Analyzer
Remove consoleOptional feature, remove console.[methodName] in code
Optimize moment.js sizeOptional feature, remove the redundant locale files of moment.js
Dedupe packagesOptional feature, remove duplicate npm packages
Component on-demand importOptional feature, selectively import code and styles from component libraries
Image compressionOptional feature, compress used image resources
PreloadOptional feature, preemptively fetch and cache the target resource for current navigation
PrefetchOptional feature, preemptively fetch and cache the target resource for a followup navigation
PreconnectOptional feature, preemptively connect to the target resource's origin
DNS prefetchOptional feature, preemptively perform DNS resolution for the target resource's origin