output.legalComments
- Type:
'linked' | 'inline' | 'none' - Default:
'linked'
Controls how legal comments are handled by the built-in JavaScript minifier. This option takes effect when JavaScript minification is enabled and does not control CSS comments.
What are legal comments?
Legal comments are JavaScript comments that contain @license or @preserve, or start with //! or /*!. By default, Rsbuild extracts them into separate license files.
For example, the LICENSE comment in React:
Optional values
You can control how legal comments are handled using these options:
linked
Extracts all legal comments to *.LICENSE.txt files and links to them with a comment.
.LICENSE.txt files are not loaded by the page, so they will not affect the page's performance.
inline
Preserves legal comments in the minified JavaScript. This may increase the size of the output bundles.
none
Removes all legal comments.
Removing license comments may violate the terms of some software licenses. Please ensure you have the right to remove these comments before using this option.

