Legal comments
Preserving or relocating license banners and headers.
#A legal comment is a banner a rewriter must not silently delete - /*! … */
headers, //! … comments and similar markers.
legalComments controls what happens to them:
| Value | Behaviour |
|---|---|
default |
Resolved to endOfFile when bundling, inline otherwise. |
none |
Drop the banners. Only legal when the licence allows it. |
inline |
Keep each banner next to the code it covers. |
endOfFile |
Collect every banner and emit them once at the top of the output. |
linked |
Put the text in a <name>.LEGAL.txt file and leave a pointer comment. |
external |
Write the <name>.LEGAL.txt files with no pointer comment. |
guchho build src/app.js --bundle --outdir=dist
linked and external need an output directory, because a .LEGAL.txt file has
to be written somewhere.
Banners and footers
#For text you want to add rather than preserve, use banner and footer. Both
are maps from file kind to text:
build: {
banner: { js: '/*! (c) 2026 CodeHemu - MIT */' },
footer: { css: '/* generated by Guchho */' },
}
The same text is available per call through TransformOptions.banner and
TransformOptions.footer.