We can improve web client loading performance by creating .br files for every asset during the deployment and serving them if client support br compression. We can reach compression level much higher than on-the-fly compression from CDN. Also, it will improve performance for self-hosted solution without CDN.
[ ] Add Brotli compression to Vite. Seems like we need to use the latest vite-plugin-compression2, but we need further investigation.
[ ] Be sure that we compress files only during cd web && pnpm build and not during development (check network tab of browser DevTools).
[ ] Set 11 compression level.
[ ] Add to the server a check: if user requesting X file has br in Accept-Encoding header and there if X.br file, serve X.br instead with Content-Encoding: br header.
[ ] Add tests
[ ] Test that browser handle it without warning in console by running pnpm build (in the root) and cd server && ./scripts/run-image.sh (or by cd server && pnpm production if Docker works in your Dev Container).
[ ] Test that it works by running pnpm build (in the root) and cd web && ./scripts/run-image.sh (or by cd web && pnpm production if Docker works in your Dev Container).
[ ] Create PR and show before/after transmitted size (by checking network tab in browser’s DevTools from production server tests).
We can improve web client loading performance by creating
.br
files for every asset during the deployment and serving them if client supportbr
compression. We can reach compression level much higher than on-the-fly compression from CDN. Also, it will improve performance for self-hosted solution without CDN.cd web && pnpm build
and not during development (check network tab of browser DevTools).11
compression level.X
file hasbr
inAccept-Encoding
header and there ifX.br
file, serveX.br
instead withContent-Encoding: br
header.pnpm build
(in the root) andcd server && ./scripts/run-image.sh
(or bycd server && pnpm production
if Docker works in your Dev Container).brotli
support out of the box (and compile brotli module is hard), we may want to add this hack to nginx configpnpm build
(in the root) andcd web && ./scripts/run-image.sh
(or bycd web && pnpm production
if Docker works in your Dev Container).