Skip to content

[Bug]: Rolldown drops @preserve from /* #__PURE__ -- @preserve */ comments, unlike Rollup #9408

@filipsobol

Description

@filipsobol

Reproduction link or steps

Rolldown REPL: https://repl.rolldown.rs/#eNptj01rwzAMhv+K8A79oE3vGYPB2H0MdgsEk8jD4MhBkbMO4/8+NV0/Dj1JevXxPsrGmTobTz0eK5lOOZn6Vu9MpyUex8gCXaRJYLYhIbzAYQtPbfvx9fnetrDfw+vIOCHPCNsDONtJ5N/15rmhhlyiTnykmwxZdWGUxAS56FRRLzS1cMKyMxxD6OMPVerp/Pcd2oPOGdIPC2SGHp0nfFvaUMBxHGB1WVudeP7/0UGbwhKvC2sFA/A0JqnhfLIaUGy1SIq5acgUJZzVMljBSUz5A35dcUs=

Rollup REPL: https://rollupjs.org/repl/?version=4.60.4&shareable=eyJleGFtcGxlIjpudWxsLCJtb2R1bGVzIjpbeyJjb2RlIjoiZXhwb3J0IGNvbnN0IHZhbHVlID0gLyogI19fUFVSRV9fIC0tIEBwcmVzZXJ2ZSAqLyBmYWN0b3J5KCk7XG5cbmZ1bmN0aW9uIGZhY3RvcnkoKSB7XG5cdHJldHVybiB7fTtcbn0iLCJpc0VudHJ5Ijp0cnVlLCJuYW1lIjoibWFpbi5qcyJ9XSwib3B0aW9ucyI6e319

What is expected?

Rolldown should preserve the original pure annotation comment shape, matching Rollup’s behavior:

const value = /* #__PURE__ -- @preserve */ factory();

function factory() {
  return {};
}

export { value };

What is actually happening?

Rolldown rewrites /* #__PURE__ -- @preserve */ to /* @__PURE__ */

This is a regression compared to Rollup. The @preserve marker is significant because downstream post-processing tools may rely on it to keep the pure annotation in distributed output.

System Info

Rolldown: `v1.0.0`

Any additional comments?

I tried different output.comments settings without luck.

Metadata

Metadata

Assignees

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions