removed vite-pwa
This commit is contained in:
parent
2b28831c2f
commit
64d6214aed
3691
package-lock.json
generated
3691
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,6 @@
|
||||
"typescript": "^5.2.2",
|
||||
"typescript-eslint": "^8.23.0",
|
||||
"vite": "^8.0.0",
|
||||
"vite-plugin-pwa": "^1.3.0",
|
||||
"vue-tsc": "^2.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
// This file is based on the one found in the laravel-notification-channels/webpush package.
|
||||
|
||||
// We need this to get the VAPID_PUBLIC_KEY from the .env file
|
||||
const vapidPublicKey = import.meta.env.VITE_VAPID_PUBLIC_KEY;
|
||||
|
||||
self.addEventListener('push', (event) => {
|
||||
const payload = event.data ? event.data.json() : {};
|
||||
|
||||
const options = {
|
||||
body: payload.body,
|
||||
icon: payload.icon,
|
||||
badge: payload.badge,
|
||||
data: {
|
||||
url: payload.url,
|
||||
},
|
||||
};
|
||||
|
||||
event.waitUntil(self.registration.showNotification(payload.title, options));
|
||||
});
|
||||
|
||||
self.addEventListener('notificationclick', (event) => {
|
||||
event.notification.close();
|
||||
|
||||
event.waitUntil(
|
||||
clients.openWindow(event.notification.data.url)
|
||||
);
|
||||
});
|
||||
|
||||
if (vapidPublicKey) {
|
||||
self.addEventListener('load', async () => {
|
||||
if ('serviceWorker' in navigator) {
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.register('/sw.js');
|
||||
console.log('Service worker registered.', registration);
|
||||
} catch (error) {
|
||||
console.error('Error registering service worker:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -35,27 +35,5 @@ export default defineConfig({
|
||||
wayfinder({
|
||||
formVariants: true,
|
||||
}),
|
||||
// VitePWA({
|
||||
// registerType: 'autoUpdate',
|
||||
// injectRegister: 'auto',
|
||||
// workbox: {
|
||||
// globPatterns: ['**/*.{js,css,html,ico,png,svg}'],
|
||||
// runtimeCaching: [
|
||||
// {
|
||||
// urlPattern: ({ url }) => url.pathname.startsWith('/'),
|
||||
// handler: 'NetworkFirst',
|
||||
// options: {
|
||||
// cacheName: 'api-cache',
|
||||
// cacheableResponse: {
|
||||
// statuses: [0, 200],
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// srcDir: 'resources/js',
|
||||
// filename: 'sw.js',
|
||||
// outDir: 'public',
|
||||
// }),
|
||||
],
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user