webui : use fflate for more deterministic gzip compress (#13525)
* webui : use pako for more deterministic gzip compress * simpler code * use fflate instead of pako
This commit is contained in:
parent
d486dd3e8e
commit
bb1681fbd5
4 changed files with 13 additions and 3 deletions
|
@ -3,7 +3,7 @@ import react from '@vitejs/plugin-react';
|
|||
import { viteSingleFile } from 'vite-plugin-singlefile';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import zlib from 'node:zlib';
|
||||
import * as fflate from 'fflate';
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
|
@ -33,9 +33,10 @@ const BUILD_PLUGINS = [
|
|||
},
|
||||
writeBundle() {
|
||||
const outputIndexHtml = path.join(config.build.outDir, 'index.html');
|
||||
const content =
|
||||
let content =
|
||||
GUIDE_FOR_FRONTEND + '\n' + fs.readFileSync(outputIndexHtml, 'utf-8');
|
||||
const compressed = zlib.gzipSync(Buffer.from(content, 'utf-8'), {
|
||||
content = content.replace(/\r/g, ''); // remove windows-style line endings
|
||||
const compressed = fflate.gzipSync(Buffer.from(content, 'utf-8'), {
|
||||
level: 9,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue