Open hyf0 opened 6 days ago
It would be nice if the codegen part of playground support comment-related options.
I fixed the empty body case.
The console.log('in a') //! Copyright notice 1
case contradicts to the documentation https://esbuild.github.io/api/#legal-comments
Note that "statement-level" for JS and "rule-level" for CSS means the comment must appear in a context where multiple statements or rules are allowed such as in the top-level scope or in a statement or rule block. So comments inside expressions or at the declaration level are not considered legal comments.
esbuild's parser saved these trailing comments as statement level comments
I'm undecided whether we should handle such cases. It takes a lot more work to handle such cases.
Since printing legal comments only have a pratical standard from esbuild, I guess we could wait for users feedback and decide what's next.
output(pure codeggen, without bundling)
esbuild