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

fix: Fix regression of swc minifier #42790

Merged
merged 4 commits into from Nov 11, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 2 additions & 15 deletions packages/next-swc/crates/napi/src/minify.rs
Expand Up @@ -31,9 +31,8 @@ use fxhash::FxHashMap;
use napi::bindgen_prelude::*;
use serde::Deserialize;
use swc_core::{
base::{config::JsMinifyOptions, try_with_handler, BoolOrDataConfig, TransformOutput},
base::{try_with_handler, TransformOutput},
common::{errors::ColorConfig, sync::Lrc, FileName, SourceFile, SourceMap, GLOBALS},
ecma::minifier::option::terser::TerserCompressorOptions,
};

use crate::{get_compiler, util::MapErr};
Expand Down Expand Up @@ -89,19 +88,7 @@ impl Task for MinifyTask {
GLOBALS.set(&Default::default(), || {
let fm = self.code.to_file(self.c.cm.clone());

self.c.minify(
fm,
handler,
&JsMinifyOptions {
compress: TerserCompressorOptions {
// inline: TerserInlineOption::Num(0).into(),
..Default::default()
}
.into(),
mangle: BoolOrDataConfig::from_bool(false),
..self.opts.clone()
},
)
self.c.minify(fm, handler, &self.opts)
})
},
)
Expand Down