boolean
false
Whether to inject styles into DOM.
By default, Rsbuild will extract CSS into a separate .css
file and output it to the dist directory. When this option is set to true
, CSS files will be inlined into JS files and inserted on the page at runtime via <style>
tags. This feature is implemented based on style-loader.
When output.injectStyles
is enabled, you can modify the options of style-loader
through tools.styleLoader.
We recommend enabling the injectStyles
option only in development.
For production builds, we recommend using Rsbuild's default behavior, which extracts CSS into separate bundles so browsers can load CSS and JS assets in parallel.
For example: