mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
fix(sw): stamp __TERMIX_SW_BASE_PATH__ and cache version into sw.js at build time (#1618)
* fix(sw): stamp __TERMIX_SW_BASE_PATH__ and version into sw.js at build time vite copies public/ verbatim, so the placeholder in public/sw.js reached dist/sw.js untouched. The service worker then requested __TERMIX_SW_BASE_PATH__/favicon.ico and friends, its install promise rejected, and it never activated - while a worker from an older release kept serving its cached frontend against a newer backend. scripts/stamp-sw-build-info.cjs now runs right after vite build and replaces both placeholders in dist/sw.js: - __TERMIX_SW_BASE_PATH__ -> the base path the build used (VITE_BASE_PATH, or root-relative by default, matching vite.config.ts) - __TERMIX_CACHE_VERSION__ -> package.json version, so CACHE_NAME changes per release and the activate handler evicts the previous build's cache Closes #1617 * chore: format stamp-sw-build-info.cjs to prettier style * fix: preserve runtime service worker base paths --------- Co-authored-by: inontz <inontz@users.noreply.github.com> Co-authored-by: ZacharyZcR <zacharyzcr1984@gmail.com>
This commit is contained in:
5 files changed
+121
-3
No files matched your search
+1
-1
@@ -26,7 +26,7 @@ COPY . .
|
||||
RUN find public/fonts -name "*.ttf" ! -name "*Regular.ttf" ! -name "*Bold.ttf" ! -name "*Italic.ttf" -delete
|
||||
|
||||
RUN npm cache clean --force && \
|
||||
NODE_OPTIONS="--max-old-space-size=3072" npm run build
|
||||
TERMIX_RUNTIME_BASE_PATH=true NODE_OPTIONS="--max-old-space-size=3072" npm run build
|
||||
|
||||
# Stage 3: Build backend
|
||||
FROM deps AS backend-builder
|
||||
|
||||
Reference in new issue
Block a user