fix gzip non deterministic
This commit is contained in:
parent
bd5e39fc0e
commit
9fc6adeb24
2 changed files with 9 additions and 0 deletions
Binary file not shown.
|
@ -30,6 +30,15 @@ const BUILD_PLUGINS = [
|
||||||
const content = GUIDE_FOR_FRONTEND + '\n' + fs.readFileSync(outputIndexHtml, 'utf-8');
|
const content = GUIDE_FOR_FRONTEND + '\n' + fs.readFileSync(outputIndexHtml, 'utf-8');
|
||||||
const compressed = zlib.gzipSync(Buffer.from(content, 'utf-8'), { level: 9 });
|
const compressed = zlib.gzipSync(Buffer.from(content, 'utf-8'), { level: 9 });
|
||||||
|
|
||||||
|
// because gzip header contains machine-specific info, we must remove these data from the header
|
||||||
|
// timestamp
|
||||||
|
compressed[0x4] = 0;
|
||||||
|
compressed[0x5] = 0;
|
||||||
|
compressed[0x6] = 0;
|
||||||
|
compressed[0x7] = 0;
|
||||||
|
// OS
|
||||||
|
compressed[0x9] = 0;
|
||||||
|
|
||||||
if (compressed.byteLength > MAX_BUNDLE_SIZE) {
|
if (compressed.byteLength > MAX_BUNDLE_SIZE) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Bundle size is too large (${Math.ceil(compressed.byteLength / 1024)} KB).\n` +
|
`Bundle size is too large (${Math.ceil(compressed.byteLength / 1024)} KB).\n` +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue