Skip to content

comments

  • Type: boolean | object with the properties below
  • Optional

Control which comments are preserved in the output.

  • true: Preserve legal, annotation, and JSDoc comments (default)
  • false: Strip all comments
  • Object: Granular control over comment categories
    • legal: @license, @preserve, //!, /*!
    • annotation: @__PURE__, @__NO_SIDE_EFFECTS__, @vite-ignore
    • jsdoc: JSDoc comments

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.

Default

ts
true

annotation?

  • Type: boolean
  • Optional

jsdoc?

  • Type: boolean
  • Optional
  • Type: boolean
  • Optional