Skip to content

fix: Remove vite-plugin-pwa, avoid this plugin caches files unexpectedly#6907

Merged
louislam merged 5 commits intomasterfrom
copilot/remove-vite-plugin-pwa
Feb 13, 2026
Merged

fix: Remove vite-plugin-pwa, avoid this plugin caches files unexpectedly#6907
louislam merged 5 commits intomasterfrom
copilot/remove-vite-plugin-pwa

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 11, 2026

vite-plugin-pwa introduces Workbox precaching that aggressively caches frontend assets (including default icons/manifest), causing status pages to serve stale favicons instead of custom ones after the first load.

The plugin was added solely for webpush notification support, but webpush only needs a service worker that listens for push events — it doesn't need Workbox or precaching.

Changes

  • public/sw.js — New static service worker with only the push notification event handler (no Workbox, no precaching)
  • src/main.js — Register the service worker explicitly on app load
  • config/vite.config.js — Remove VitePWA plugin
  • src/serviceWorker.ts — Deleted (was only needed as vite-plugin-pwa's injectManifest input)
  • package.json — Uninstall vite-plugin-pwa

Service worker (entire file)

self.addEventListener("push", function (event) {
    if (self.Notification?.permission !== "granted") {
        return;
    }
    if (event.data) {
        let message = event.data.json();
        self.registration.showNotification(message.title, { body: message.body });
    }
});

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits February 11, 2026 07:52
Replace the vite-plugin-pwa build pipeline with a simple static
service worker (public/sw.js) that only handles push notifications.
This removes the Workbox precaching that was causing favicon/manifest
caching issues (#6902) while keeping webpush notifications working.

Changes:
- Create public/sw.js with push notification handler
- Register service worker in src/main.js
- Remove VitePWA plugin from vite config
- Delete src/serviceWorker.ts
- Uninstall vite-plugin-pwa dependency

Co-authored-by: louislam <1336778+louislam@users.noreply.github.com>
Co-authored-by: louislam <1336778+louislam@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove vite-plugin-pwa while retaining web push and service worker functionality Remove vite-plugin-pwa, keep service worker for webpush Feb 11, 2026
Copilot AI requested a review from louislam February 11, 2026 07:55
@louislam
Copy link
Copy Markdown
Owner

The change looks solid. Need manual test.

@louislam louislam linked an issue Feb 11, 2026 that may be closed by this pull request
1 task
@louislam louislam changed the title Remove vite-plugin-pwa, keep service worker for webpush fix: Remove vite-plugin-pwa, avoid this plugin caches files unexpectedly Feb 11, 2026
@louislam louislam added this to the 2.1.1 milestone Feb 11, 2026
@louislam louislam mentioned this pull request Feb 11, 2026
19 tasks
@louislam louislam marked this pull request as ready for review February 13, 2026 01:52
Copilot AI review requested due to automatic review settings February 13, 2026 01:52
@github-actions github-actions bot added the pr:needs review this PR needs a review by maintainers or other community members label Feb 13, 2026
@louislam
Copy link
Copy Markdown
Owner

Tested, it works fine.

image

@louislam
Copy link
Copy Markdown
Owner

Oh, wait, why it is "undefined".

This comment was marked as resolved.

@louislam
Copy link
Copy Markdown
Owner

Fixed along with this pr, I believe it is because there was no final manual test in #6421.

Let's just keep it simple, we should just use msg with Uptime Kuma as title.

image

@louislam louislam merged commit 5561842 into master Feb 13, 2026
23 of 25 checks passed
@louislam louislam deleted the copilot/remove-vite-plugin-pwa branch February 13, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:needs review this PR needs a review by maintainers or other community members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Favicon/ PWA manifest (?) issue with 2.1.0

3 participants