diff --git a/pkgs/core/build.ts b/pkgs/core/build.ts index c0d509af..2d2648af 100644 --- a/pkgs/core/build.ts +++ b/pkgs/core/build.ts @@ -69,15 +69,20 @@ if (files) { files .filter((file) => statSync(dir.path(`app/static/${file}`)).isFile()) .map(async (file) => { - const br = brotli.compress( - new Uint8Array( - await Bun.file(dir.path(`app/static/${file}`)).arrayBuffer() - ), - { quality: 11 } - ); - if (br) { - console.log(`Compressing ${file}`); - await writeAsync(dir.path(`app/static-br/${file}`), Buffer.from(br)); + if (!(await Bun.file(dir.path(`app/static-br/${file}`)).exists())) { + const br = brotli.compress( + new Uint8Array( + await Bun.file(dir.path(`app/static/${file}`)).arrayBuffer() + ), + { quality: 11 } + ); + if (br) { + console.log(`Compressing ${file}`); + await writeAsync( + dir.path(`app/static-br/${file}`), + Buffer.from(br) + ); + } } }) );