refactor: Colocate service worker build script with source files
Move build script from scripts/build-service-worker.js to app/javascript/service-worker/build.js to keep all service worker related code in one place. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
38232a73dc
commit
adbee23e12
@@ -46,7 +46,7 @@ self.addEventListener('fetch', event => {
|
||||
// Assets (JS/CSS/fonts) → cache-first
|
||||
const isAsset =
|
||||
url.pathname.startsWith('/vite-dev/') ||
|
||||
url.pathname.startsWith('/packs/') ||
|
||||
url.pathname.startsWith('/vite/') ||
|
||||
url.origin === ASSET_ORIGIN ||
|
||||
/\.(js|css|woff2?|ttf|otf|eot)$/i.test(url.pathname);
|
||||
|
||||
@@ -183,7 +183,7 @@ async function cleanupStaleAssets() {
|
||||
.filter(request => {
|
||||
const url = new URL(request.url);
|
||||
const isAssetPath =
|
||||
url.pathname.startsWith('/packs/assets/') ||
|
||||
url.pathname.startsWith('/vite/assets/') ||
|
||||
url.pathname.startsWith('/vite-dev/assets/');
|
||||
// Only clean up asset files, keep other cached items (like /app shell)
|
||||
return isAssetPath && !validUrls.has(request.url);
|
||||
|
||||
Reference in New Issue
Block a user