From 29fbf7cd3fedd8aa8bcfb06292586fa184e47cef Mon Sep 17 00:00:00 2001 From: dev-warrior777 <> Date: Thu, 5 Dec 2024 18:26:20 +0800 Subject: [PATCH] client,webserver: webpack build ID used as browser cache ID. - Emit a webpack build ID when building site and store in webpack-build-id.txt - Embed the webpack build ID into bodybuilder as a url query string:- webpackBuildIdQuery fetches latest webpack build from the webpack-build-id.txt file in app site directory and makes it available to append to the main css link and to the main script link in bodybuilder; this should cause no reload of the main css/js files if they are already cached by the browser. If webpackBuildIdFile is not found return a fallback query that will make the browser reload css/js. - Some eslint in webpack dir. --- .gitignore | 1 + .../webserver/site/src/html/bodybuilder.tmpl | 4 +- client/webserver/site/src/js/app.ts | 6 ++- client/webserver/site/src/js/locales.ts | 6 +-- client/webserver/site/src/js/registry.ts | 1 + client/webserver/site/webpack/analyze.js | 2 +- client/webserver/site/webpack/common.js | 27 +++++++++++--- client/webserver/site/webpack/dev.js | 2 +- client/webserver/site/webpack/prod.js | 2 +- client/webserver/template.go | 37 +++++++++++++++++++ 10 files changed, 73 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 0e82613dfd..38453a6532 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ dex/testing/loadbot/loadbot bin/ bin-v*/ client/webserver/site/template-builder/template-builder +client/webserver/site/webpack-build-id.txt dex/testing/btc/harnesschain.tar.gz client/asset/btc/electrum/example/server/server client/asset/btc/electrum/example/wallet/wallet diff --git a/client/webserver/site/src/html/bodybuilder.tmpl b/client/webserver/site/src/html/bodybuilder.tmpl index ac9cad80ff..8fa851e01a 100644 --- a/client/webserver/site/src/html/bodybuilder.tmpl +++ b/client/webserver/site/src/html/bodybuilder.tmpl @@ -9,7 +9,7 @@