LibreChat/.github
Marco Beretta fdd5f9ce65
🖼️ fix: Precache PWA Icons and Let Them Refresh (#15654)
* 🖼️ fix: Precache PWA Icons and Let Them Refresh

Production builds set `publicDir: false`, so `client/scripts/post-build.cjs`
copied `public/assets` into `dist/assets` only after `vite build` had finished.
vite-plugin-pwa globs `dist/` from its `closeBundle` hook, inside that build, so
the icon patterns in `workbox.globPatterns` matched zero files and the generated
`sw.js` shipped without a single icon, silently: workbox treats an empty glob as
a no-op. `build:ci`, used by the Playwright lanes, never ran the post-build step
at all and produced a `dist` with no icons or `robots.txt`.

Move the copy into a `copyPublicAssets()` build plugin that runs in
`writeBundle`, which completes for every plugin before `closeBundle`, and drop
the post-build script with its lone `fs-extra` dependency.

Ordering alone was not enough. The plugin defaults `dontCacheBustURLsMatching`
to `/^assets\//`, true only for hashed bundle output. The icons live in
`assets/` under stable filenames, so they entered the manifest with
`revision: null`, permanently immutable, meaning an installed PWA would never
pick up a rebranded icon: the other half of the report. Match Vite's
`[name].[hash].[ext]` shape instead so hashed chunks stay revision-free while
the icons carry content revisions.

Also drop `manifest.webmanifest` from `globPatterns`, since the plugin always
appends it as an additional manifest entry and globbing it duplicated the
precache entry.

A clean `npm run build` now yields 55 precache entries with all five icons
revisioned, against 0 icon entries before.

* 📝 docs: Describe the Full Copy Set in copyPublicAssets

* 🔒 chore: Drop fs-extra From bun.lock
2026-09-06 11:32:09 -04:00
..
ISSUE_TEMPLATE 🆔 feat: Built-in Build Metadata for Support Triage (#12756) 2026-05-23 09:41:13 -04:00
scripts 🎯 ci: Retarget Pull Requests Opened Against main to dev (#15416) 2026-08-31 11:29:34 -04:00
workflows 🖼️ fix: Precache PWA Icons and Let Them Refresh (#15654) 2026-09-06 11:32:09 -04:00
CODE_OF_CONDUCT.md 🔗 chore: Add Stable Discord and Homepage Links (#1835) 2024-02-19 09:42:57 -05:00
configuration-release.json 📜 ci: AutomateCHANGELOG.md (#5838) 2025-02-18 08:35:43 -05:00
configuration-unreleased.json 📜 ci: AutomateCHANGELOG.md (#5838) 2025-02-18 08:35:43 -05:00
CONTRIBUTING.md 🎯 ci: Retarget Pull Requests Opened Against main to dev (#15416) 2026-08-31 11:29:34 -04:00
FUNDING.yml
playwright.yml ⚙️ ci: Bump GitHub Actions to Node.js 24 Runtimes (#14689) 2026-08-07 11:25:29 -04:00
pull_request_template.md 🧹 chore: remove old docs (#2684) 2024-05-13 10:15:30 -04:00
SECURITY.md ✨ v0.8.8-rc2 (#14845) 2026-09-02 22:18:48 -04:00