Appearance
boolean
Control which comments are preserved in the output.
true
false
Note: Regular line and block comments without these markers are always removed regardless of this option.
When both legalComments and comments.legal are set, comments.legal takes priority.
legalComments
comments.legal
WARNING
Some comments may be still removed due to some known bugs: #7257, #7387
Comments that contain @__PURE__, @__NO_SIDE_EFFECTS__ or @vite-ignore
@__PURE__
@__NO_SIDE_EFFECTS__
@vite-ignore
JSDoc comments
Comments that contain @license, @preserve or start with //! or /*!
@license
@preserve
//!
/*!
comments
boolean| object with the properties belowControl which comments are preserved in the output.
true: Preserve legal, annotation, and JSDoc comments (default)false: Strip all commentsNote: Regular line and block comments without these markers are always removed regardless of this option.
When both
legalCommentsandcomments.legalare set,comments.legaltakes priority.WARNING
Some comments may be still removed due to some known bugs: #7257, #7387
Default
annotation?
booleanComments that contain
@__PURE__,@__NO_SIDE_EFFECTS__or@vite-ignorejsdoc?
booleanJSDoc comments
legal?
booleanComments that contain
@license,@preserveor start with//!or/*!