🐛 Fix to show the notification for updating service worker (#5963)

* Fix to show the notification for updating service worker

* cleanup

* Add release notes for PR #5963

* trigger pipeline

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
lelemm
2025-10-19 22:48:05 -03:00
committed by GitHub
parent 23f1b7d3c0
commit be35328e42
6 changed files with 12 additions and 17 deletions

View File

@@ -28,7 +28,6 @@ const fileList = new Map<string, string>();
// Log installation event
self.addEventListener('install', (_event: ExtendableEvent) => {
console.log('Plugins Worker installing...');
self.skipWaiting(); // Forces activation immediately
});
// Log activation event
@@ -64,6 +63,8 @@ self.addEventListener('fetch', (event: FetchEvent) => {
? pathSegments[slugIndex + 1].split('?')[0]
: '';
event.respondWith(handlePlugin(slug, fileName.replace('?import', '')));
} else {
event.respondWith(fetch(event.request));
}
});

View File

@@ -6,7 +6,6 @@ import { defineConfig } from 'vite';
export default defineConfig(({ mode }) => {
const isDev = mode === 'development';
const outDir = path.resolve(__dirname, 'dist');
const buildHash = Date.now().toString(36);
return {
mode,
@@ -18,8 +17,7 @@ export default defineConfig(({ mode }) => {
entry: path.resolve(__dirname, 'src/plugin-service-worker.ts'),
name: 'plugin_sw',
formats: ['iife'],
fileName: () =>
isDev ? `plugin-sw.dev.js` : `plugin-sw.${buildHash}.js`,
fileName: () => `plugin-sw.js`,
},
sourcemap: true,
minify: isDev ? false : 'terser',