Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserving annotations / magic comments #9255

Closed
mayank99 opened this issue Jul 15, 2024 · 1 comment · Fixed by #9449
Closed

preserving annotations / magic comments #9255

mayank99 opened this issue Jul 15, 2024 · 1 comment · Fixed by #9449
Assignees
Milestone

Comments

@mayank99
Copy link

Describe the feature

Many tools rely on "magic comments", such as /*#__PURE__*/ and /*@vite-ignore*/. These comments are currently stripped out by SWC when using jsc.minify, unless you set jsc.minify.format.comments to "all" (which will preserve even non-meaningful comments).

It would be nice if SWC would preserve comments that start with # or @ when using comments: "some". It makes sense because SWC itself adds /*#__PURE__*/ comments.

As a bonus, it would be nice if this was also configurable, so that custom comments like /*webpackIgnore*/ can also be preserved.

Babel plugin or link to the feature description

No response

Additional context

Terser has a similar feature called preserve-annotations which is currently no-op in SWC. It might be good to support this properly in SWC.

@kdy1 kdy1 added this to the Planned milestone Jul 16, 2024
@kdy1 kdy1 self-assigned this Jul 16, 2024
@kdy1 kdy1 closed this as completed in 673655c Aug 19, 2024
@kdy1 kdy1 modified the milestones: Planned, v1.7.13 Aug 19, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Sep 18, 2024

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

3 participants