To enable on-demand imports for a component library, configure source.transformImport. This works the same way as babel-plugin-import.
export default {
source: {
transformImport: [
{
libraryName: 'my-components',
libraryDirectory: 'es',
style: true,
},
],
},
};To protect compilation performance, Rsbuild doesn't run ESLint checks during builds by default. If you need ESLint in the pipeline, use the ESLint plugin.
To serve static assets like JS and CSS from a CDN, set the asset URL prefix with output.assetPrefix.
export default {
output: {
assetPrefix: 'https://cdn.example.com/assets/',
},
};In production builds, you can strip console calls to avoid shipping development logs.
Rsbuild provides a built-in option for removing console statements. See performance.removeConsole.
Use Rsbuild's debug mode to view the Rspack configuration that Rsbuild generates.
Enable debug mode by setting the DEBUG=rsbuild environment variable when running a build. In this mode, the generated Rspack configuration is written to the dist directory.
➜ DEBUG=rsbuild pnpm dev
...
rsbuild 10:00:00 configuration loaded from: /path/to/...
rsbuild 10:00:00 registering default plugins
rsbuild 10:00:00 default plugins registered
...
config inspection completed, generated files:
- Rsbuild config: /root/my-project/dist/.rsbuild/rsbuild.config.mjs
- Rspack config (web): /root/my-project/dist/.rsbuild/rspack.config.web.mjsBy default, Rsbuild prints all errors and warnings from the build.
If a noisy third-party package produces many warnings, you can silence specific messages with Rspack's ignoreWarnings configuration.
export default {
tools: {
rspack: {
ignoreWarnings: [/Using \/ for division outside of calc()/],
},
},
};For details, please refer to: ignoreWarnings.