Skip to content

Commit 9fc6ade

Browse files
committed
fix gzip non deterministic
1 parent bd5e39f commit 9fc6ade

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed
0 Bytes
Binary file not shown.

examples/server/webui/vite.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ const BUILD_PLUGINS = [
3030
const content = GUIDE_FOR_FRONTEND + '\n' + fs.readFileSync(outputIndexHtml, 'utf-8');
3131
const compressed = zlib.gzipSync(Buffer.from(content, 'utf-8'), { level: 9 });
3232

33+
// because gzip header contains machine-specific info, we must remove these data from the header
34+
// timestamp
35+
compressed[0x4] = 0;
36+
compressed[0x5] = 0;
37+
compressed[0x6] = 0;
38+
compressed[0x7] = 0;
39+
// OS
40+
compressed[0x9] = 0;
41+
3342
if (compressed.byteLength > MAX_BUNDLE_SIZE) {
3443
throw new Error(
3544
`Bundle size is too large (${Math.ceil(compressed.byteLength / 1024)} KB).\n` +

0 commit comments

Comments
 (0)