oxc icon indicating copy to clipboard operation
oxc copied to clipboard

codegen: preserve legal comments with whitespace removal

Open Boshen opened this issue 8 months ago • 1 comments

downstream: https://github.com/rolldown/rolldown/issues/4118

when codegen minify: true, we still want to keep legal comments

https://esbuild.github.io/try/#dAAwLjI0LjAALS1taW5pZnkAYXNkZiArIC8qIEBwcmVzZXJ2ZSAqLyBiOwoKLyogQHByZXNlcnZlICovIAoKYXNkZiArIGIKCi8qIEBwcmVzZXJ2ZSAqLyAK

As a bonus: deduplicate repeated legal comments https://github.com/evanw/esbuild/commit/a54916b92c128aa0596a65bcbafcde1074acf63d

Boshen avatar Apr 25 '25 13:04 Boshen

when codegen minify: true

To be more specific, the conditions are String -> AST -> Minified AST(Minifier) -> String with comments(Codegen with minify: true).

hyf0 avatar Apr 25 '25 13:04 hyf0