fix(es/minifier): Don't remove comments if compress is not configured (#3866)

This commit is contained in:
Donny/강동윤 2022-03-05 19:01:55 +09:00 committed by GitHub
parent d9fd79db86
commit e70c9d8f22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -343,6 +343,10 @@ impl VisitMut for MinifierPass {
..Default::default()
};
if opts.compress.is_none() && opts.mangle.is_none() {
return;
}
m.map_with_mut(|m| {
swc_ecma_minifier::optimize(
m,

View File

@ -91,7 +91,9 @@ pub fn optimize(
m.visit_mut_with(&mut precompress_optimizer(options, marks));
}
m.visit_mut_with(&mut info_marker(comments, marks, extra.top_level_mark));
if options.compress.is_some() {
m.visit_mut_with(&mut info_marker(comments, marks, extra.top_level_mark));
}
m.visit_mut_with(&mut unique_scope());
if options.wrap {