chore: minify html for production build (@fehmer) (#6413)

This commit is contained in:
Christian Fehmer 2025-03-30 19:50:08 +02:00 committed by GitHub
parent 6aeab4d3fc
commit f7be839e74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 96 additions and 3 deletions

View file

@ -65,6 +65,7 @@
"vite-plugin-filter-replace": "0.1.13",
"vite-plugin-html-inject": "1.1.2",
"vite-plugin-inspect": "0.8.3",
"vite-plugin-minify": "2.1.0",
"vite-plugin-pwa": "0.20.0",
"vitest": "2.1.9"
},

View file

@ -11,6 +11,7 @@ import { writeFileSync } from "fs";
// eslint-disable-next-line import/no-unresolved
import UnpluginInjectPreload from "unplugin-inject-preload/vite";
import { readdirSync, readFileSync, statSync } from "node:fs";
import { ViteMinifyPlugin } from "vite-plugin-minify";
function pad(numbers, maxLength, fillString) {
return numbers.map((number) =>
@ -85,6 +86,7 @@ export default {
},
}),
splitVendorChunkPlugin(),
ViteMinifyPlugin({}),
VitePWA({
// injectRegister: "networkfirst",
injectRegister: "script-defer",

96
pnpm-lock.yaml generated
View file

@ -460,6 +460,9 @@ importers:
vite-plugin-inspect:
specifier: 0.8.3
version: 0.8.3(rollup@2.79.1)(vite@6.0.12(@types/node@20.14.11)(sass@1.70.0)(terser@5.31.3)(tsx@4.16.2)(yaml@2.5.0))
vite-plugin-minify:
specifier: 2.1.0
version: 2.1.0(vite@6.0.12(@types/node@20.14.11)(sass@1.70.0)(terser@5.31.3)(tsx@4.16.2)(yaml@2.5.0))
vite-plugin-pwa:
specifier: 0.20.0
version: 0.20.0(vite@6.0.12(@types/node@20.14.11)(sass@1.70.0)(terser@5.31.3)(tsx@4.16.2)(yaml@2.5.0))(workbox-build@7.1.1)(workbox-window@7.1.0)
@ -2940,6 +2943,9 @@ packages:
'@types/howler@2.2.7':
resolution: {integrity: sha512-PEZldwZqJJw1PWRTpupyC7ajVTZA8aHd8nB/Y0n6zRZi5u8ktYDntsHj13ltEiBRqWwF06pASxBEvCTxniG8eA==}
'@types/html-minifier-terser@7.0.2':
resolution: {integrity: sha512-mm2HqV22l8lFQh4r2oSsOEVea+m0qqxEmwpc9kC1p/XzmjLWrReR9D/GRs8Pex2NX/imyEH9c5IU/7tMBQCHOA==}
'@types/http-errors@2.0.4':
resolution: {integrity: sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==}
@ -3689,6 +3695,7 @@ packages:
bson@6.8.0:
resolution: {integrity: sha512-iOJg8pr7wq2tg/zSlCCHMi3hMm5JTOxLTagf3zxhcenHsFp+c6uOs6K7W5UE7A4QIJGtqh/ZovFNMP4mOPJynQ==}
engines: {node: '>=16.20.1'}
deprecated: a critical bug affecting only useBigInt64=true deserialization usage is fixed in bson@6.10.3
buffer-crc32@0.2.13:
resolution: {integrity: sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==}
@ -3768,6 +3775,9 @@ packages:
camel-case@3.0.0:
resolution: {integrity: sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==}
camel-case@4.1.2:
resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==}
camelcase-keys@6.2.2:
resolution: {integrity: sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==}
engines: {node: '>=8'}
@ -3882,6 +3892,10 @@ packages:
resolution: {integrity: sha512-EJUDT7nDVFDvaQgAo2G/PJvxmp1o/c6iXLbswsBbUFXi1Nr+AjA2cKmfbKDMjMvzEe75g3P6JkaDDAKk96A85A==}
engines: {node: '>= 4.0'}
clean-css@5.3.3:
resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==}
engines: {node: '>= 10.0'}
clean-stack@2.2.0:
resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==}
engines: {node: '>=6'}
@ -4609,6 +4623,9 @@ packages:
domutils@3.1.0:
resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==}
dot-case@3.0.4:
resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==}
dot-prop@5.3.0:
resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==}
engines: {node: '>=8'}
@ -5670,6 +5687,11 @@ packages:
html-escaper@2.0.2:
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
html-minifier-terser@7.2.0:
resolution: {integrity: sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==}
engines: {node: ^14.13.1 || >=16.0.0}
hasBin: true
html-minifier@4.0.0:
resolution: {integrity: sha512-aoGxanpFPLg7MkIl/DDFYtb0iWz7jMFGqFhvEDZga6/4QTjneiD8I/NXL1x5aaoCp7FSIT6h/OhykDdPsbtMig==}
engines: {node: '>=6'}
@ -6580,6 +6602,9 @@ packages:
lower-case@1.1.4:
resolution: {integrity: sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==}
lower-case@2.0.2:
resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==}
lru-cache@10.4.3:
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
@ -7146,6 +7171,9 @@ packages:
no-case@2.3.2:
resolution: {integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==}
no-case@3.0.4:
resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==}
node-addon-api@5.1.0:
resolution: {integrity: sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==}
@ -7476,6 +7504,9 @@ packages:
param-case@2.1.1:
resolution: {integrity: sha512-eQE845L6ot89sk2N8liD8HAuH4ca6Vvr7VWAWwt7+kvvG5aBcPmmphQ68JsEG2qa9n1TykS2DLeMt363AAH8/w==}
param-case@3.0.4:
resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==}
parent-module@1.0.1:
resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==}
engines: {node: '>=6'}
@ -7531,6 +7562,9 @@ packages:
resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==}
engines: {node: '>= 0.8'}
pascal-case@3.1.2:
resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==}
pascalcase@0.1.1:
resolution: {integrity: sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw==}
engines: {node: '>=0.10.0'}
@ -9527,6 +9561,11 @@ packages:
'@nuxt/kit':
optional: true
vite-plugin-minify@2.1.0:
resolution: {integrity: sha512-h+Ae0WX0mvrWM4GhE6JX2NmxlDuZRv4AgcTHFqfbSyPwS+OdlOM692AQrK0eO8lDEh7gYLjG3EHovKvtrNQDvA==}
peerDependencies:
vite: '>=5'
vite-plugin-pwa@0.20.0:
resolution: {integrity: sha512-/kDZyqF8KqoXRpMUQtR5Atri/7BWayW8Gp7Kz/4bfstsV6zSFTxjREbXZYL7zSuRL40HGA+o2hvUAFRmC+bL7g==}
engines: {node: '>=16.0.0'}
@ -12437,6 +12476,8 @@ snapshots:
'@types/howler@2.2.7': {}
'@types/html-minifier-terser@7.0.2': {}
'@types/http-errors@2.0.4': {}
'@types/ioredis@4.28.10':
@ -13455,6 +13496,11 @@ snapshots:
no-case: 2.3.2
upper-case: 1.1.3
camel-case@4.1.2:
dependencies:
pascal-case: 3.1.2
tslib: 2.6.3
camelcase-keys@6.2.2:
dependencies:
camelcase: 5.3.1
@ -13589,6 +13635,10 @@ snapshots:
dependencies:
source-map: 0.6.1
clean-css@5.3.3:
dependencies:
source-map: 0.6.1
clean-stack@2.2.0: {}
cli-boxes@2.2.1: {}
@ -14311,6 +14361,11 @@ snapshots:
domelementtype: 2.3.0
domhandler: 5.0.3
dot-case@3.0.4:
dependencies:
no-case: 3.0.4
tslib: 2.6.3
dot-prop@5.3.0:
dependencies:
is-obj: 2.0.0
@ -14658,7 +14713,7 @@ snapshots:
debug: 4.3.6(supports-color@5.5.0)
enhanced-resolve: 5.17.1
eslint: 8.57.1
eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-plugin-import@2.29.0)(eslint@8.57.1))(eslint@8.57.1)
eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.1)
eslint-plugin-import: 2.29.0(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.1)
fast-glob: 3.3.2
get-tsconfig: 4.7.6
@ -14670,7 +14725,7 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
eslint-module-utils@2.8.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-plugin-import@2.29.0)(eslint@8.57.1))(eslint@8.57.1):
eslint-module-utils@2.8.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.1):
dependencies:
debug: 3.2.7
optionalDependencies:
@ -14691,7 +14746,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.1
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-plugin-import@2.29.0)(eslint@8.57.1))(eslint@8.57.1)
eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.2.0(eslint@8.57.1)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.1)
hasown: 2.0.2
is-core-module: 2.15.0
is-glob: 4.0.3
@ -15999,6 +16054,16 @@ snapshots:
html-escaper@2.0.2: {}
html-minifier-terser@7.2.0:
dependencies:
camel-case: 4.1.2
clean-css: 5.3.3
commander: 10.0.1
entities: 4.5.0
param-case: 3.0.4
relateurl: 0.2.7
terser: 5.31.3
html-minifier@4.0.0:
dependencies:
camel-case: 3.0.0
@ -16924,6 +16989,10 @@ snapshots:
lower-case@1.1.4: {}
lower-case@2.0.2:
dependencies:
tslib: 2.6.3
lru-cache@10.4.3: {}
lru-cache@5.1.1:
@ -17700,6 +17769,11 @@ snapshots:
dependencies:
lower-case: 1.1.4
no-case@3.0.4:
dependencies:
lower-case: 2.0.2
tslib: 2.6.3
node-addon-api@5.1.0: {}
node-emoji@2.1.3:
@ -18087,6 +18161,11 @@ snapshots:
dependencies:
no-case: 2.3.2
param-case@3.0.4:
dependencies:
dot-case: 3.0.4
tslib: 2.6.3
parent-module@1.0.1:
dependencies:
callsites: 3.1.0
@ -18141,6 +18220,11 @@ snapshots:
parseurl@1.3.3: {}
pascal-case@3.1.2:
dependencies:
no-case: 3.0.4
tslib: 2.6.3
pascalcase@0.1.1: {}
path-browserify@1.0.1: {}
@ -20418,6 +20502,12 @@ snapshots:
- rollup
- supports-color
vite-plugin-minify@2.1.0(vite@6.0.12(@types/node@20.14.11)(sass@1.70.0)(terser@5.31.3)(tsx@4.16.2)(yaml@2.5.0)):
dependencies:
'@types/html-minifier-terser': 7.0.2
html-minifier-terser: 7.2.0
vite: 6.0.12(@types/node@20.14.11)(sass@1.70.0)(terser@5.31.3)(tsx@4.16.2)(yaml@2.5.0)
vite-plugin-pwa@0.20.0(vite@6.0.12(@types/node@20.14.11)(sass@1.70.0)(terser@5.31.3)(tsx@4.16.2)(yaml@2.5.0))(workbox-build@7.1.1)(workbox-window@7.1.0):
dependencies:
debug: 4.3.6(supports-color@5.5.0)