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

Also fixed webpush wrong msg

Co-authored-by: Louis Lam <louislam@users.noreply.github.com>
This commit is contained in:
Copilot
2026-02-13 10:24:37 +08:00
committed by GitHub
co-authored by Louis Lam
parent 72a5a36541
commit 5561842dea
6 changed files with 11 additions and 3004 deletions
+6
View File
@@ -44,6 +44,12 @@ app.component("FontAwesomeIcon", FontAwesomeIcon);
app.mount("#app");
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js", { scope: "/" }).catch((error) => {
console.error("Service worker registration failed:", error);
});
}
// Expose the vue instance for development
if (process.env.NODE_ENV === "development") {
console.log("Dev Only: window.app is the vue instance");
-23
View File
@@ -1,23 +0,0 @@
// Needed per Vite PWA docs
import { precacheAndRoute } from "workbox-precaching";
declare let self: ServiceWorkerGlobalScope;
precacheAndRoute(self.__WB_MANIFEST);
// Receive push notifications
self.addEventListener("push", function (event) {
if (self.Notification?.permission !== "granted") {
console.error("Notifications aren't supported or permission not granted!");
return;
}
if (event.data) {
let message = event.data.json();
try {
self.registration.showNotification(message.title, {
body: message.body,
});
} catch (error) {
console.error("Failed to show notification:", error);
}
}
});