Skip to content

Commit 0b1af71

Browse files
kfuledead-claudia
authored andcommitted
Upgrade the version of Terser to make reduce_funcs work well
1 parent b03e421 commit 0b1af71

File tree

4 files changed

+152
-34
lines changed

4 files changed

+152
-34
lines changed

package-lock.json

Lines changed: 148 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"npm-run-all": "^4.1.5",
3131
"ospec": "4.2.1",
3232
"rimraf": "^6.0.1",
33-
"terser": "^4.3.4"
33+
"terser": "^5.7.2"
3434
}
3535
}

scripts/bundler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ async function build() {
4242
return
4343
}
4444
console.log("minifying...")
45-
// Terser's “compress” option seems to degrade performance. So, disable it.
46-
const minified = Terser.minify(original, {compress: false, mangle: true})
45+
// Terser's "reduce_funcs" option seems to degrade performance. So, disable it.
46+
const minified = await Terser.minify(original, {compress: {reduce_funcs: false}, mangle: true})
4747
if (minified.error) throw new Error(minified.error)
4848
await writeFile(params.output, minified.code, "utf-8")
4949
const originalSize = Buffer.byteLength(original, "utf-8")

scripts/minify-stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async function minify() {
3535
const input = path.resolve(__dirname, "../stream/stream.js")
3636
const output = path.resolve(__dirname, "../stream/stream.min.js")
3737
const original = await fs.readFile(input, "utf-8")
38-
const minified = Terser.minify(original)
38+
const minified = await Terser.minify(original)
3939
if (minified.error) throw new Error(minified.error)
4040
await fs.writeFile(output, minified.code, "utf-8")
4141
const originalSize = Buffer.byteLength(original, "utf-8")

0 commit comments

Comments
 (0)