t00-multiuser/server/tooling/mangle.ts

10 lines
310 B
TypeScript
Raw Normal View History

2024-04-18 23:18:49 +01:00
import { readFileSync, writeFileSync } from "fs";
import { minify } from "terser";
(async () => {
const mangled = await minify(readFileSync("./build/index.js").toString(), {
mangle: true,
toplevel: true,
});
writeFileSync("./build/index.min.js", `${mangled.code?.replaceAll("new Array", "[]")}`);
})();