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

How to keep all my comments code? #1439

Closed
anchengjian opened this issue Jul 10, 2021 · 3 comments
Closed

How to keep all my comments code? #1439

anchengjian opened this issue Jul 10, 2021 · 3 comments

Comments

@anchengjian
Copy link

How to keep all my comments code, not just the LegalComments ???

@evanw
Copy link
Owner

evanw commented Jul 10, 2021

This is not supported. You should use another tool instead.

@anchengjian
Copy link
Author

why ?

@nettybun
Copy link

nettybun commented Jul 13, 2021

@anchengjian It's not part of the AST (kinda; I mean legal comments and __PURE__ comments are...). Evan explains why here #221 (comment)

It's a bummer I know, but handling comments is hard logic to code correctly and esbuild is trying to be fast and lean. It's a large undertaking to get it right, I think.

I'd like them to stay too. Not sure if this is your use case at all but: my team publishes npm packages that other internal teams use. It's common for people to ctrl+click an import to want to see the node_modules code. With webpack, we'd see close-to-sourcecode code that had comments. After moving to esbuild we lost that. Our workaround was to use --banner to put a comment linking to the GitLab source code so people can read the comments in their browser. It's not ideal but might work if you want to at least redirect people to commented code...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants