From 1a6847f1c6601e3459a341395aba848af3a6fb01 Mon Sep 17 00:00:00 2001 From: kfule Date: Mon, 23 Dec 2024 23:22:44 +0900 Subject: [PATCH] disable Terser's "compress" option for performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Terser's “compress” option seems to degrade performance. So, disable it. This commit will increase file size by about 1%, but performance appears to improve. --- scripts/bundler.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/bundler.js b/scripts/bundler.js index 2c3f63333..a1b962f05 100644 --- a/scripts/bundler.js +++ b/scripts/bundler.js @@ -42,7 +42,8 @@ async function build() { return } console.log("minifying...") - const minified = Terser.minify(original) + // Terser's “compress” option seems to degrade performance. So, disable it. + const minified = Terser.minify(original, {compress: false, mangle: true}) if (minified.error) throw new Error(minified.error) await writeFile(params.output, minified.code, "utf-8") const originalSize = Buffer.byteLength(original, "utf-8")