Skip to content

Commit

Permalink
disable Terser's "compress" option for performance
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kfule authored and dead-claudia committed Dec 26, 2024
1 parent cf012d2 commit 1a6847f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1a6847f

Please sign in to comment.