---
url: /reference/OutputOptions.comments.md
---
# 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

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**

Comments that contain `@__PURE__`, `@__NO_SIDE_EFFECTS__` or `@vite-ignore`

## jsdoc?

* **Type**: `boolean`
* **Optional**

JSDoc comments

## legal?

* **Type**: `boolean`
* **Optional**

Comments that contain `@license`, `@preserve` or start with `//!` or `/*!`
