Skip to content

Use relative asset URLs, add maskable icon and offline handling in service worker#35

Merged
Ivanx32 merged 1 commit intomainfrom
codex/analyze-pwa-deployment-issues
Mar 4, 2026
Merged

Use relative asset URLs, add maskable icon and offline handling in service worker#35
Ivanx32 merged 1 commit intomainfrom
codex/analyze-pwa-deployment-issues

Conversation

@Ivanx32
Copy link
Copy Markdown
Owner

@Ivanx32 Ivanx32 commented Mar 4, 2026

Motivation

  • Ensure assets resolve correctly when the app is served from different base paths and make the PWA manifest more complete by adding background_color and a maskable icon entry.
  • Improve offline behavior by consistently referencing the precached offline page and handling the SKIP_WAITING message shape from the service worker registration.

Description

  • Converted absolute paths to relative paths in app/index.html for manifest, icon, and the app script by changing /... to ./... and removed a placeholder comment.
  • Made the app header use the runtime base URL for the logo by constructing iconPath with import.meta.env.BASE_URL and replaced the hardcoded /icons/placeholder.svg with that variable in app/src/App.tsx.
  • Updated the service worker in app/src/sw.ts to compute OFFLINE_URL relative to the service worker scope, accept message objects with { type: 'SKIP_WAITING' }, and use OFFLINE_URL in precacheAndRoute and when falling back to the cached offline page.
  • Enhanced the PWA manifest in app/public/manifest.json and vite.config.ts by adding background_color and a maskable icon entry, and changed icon src entries to relative paths (removed leading /).

Testing

  • Ran a TypeScript type check with tsc --noEmit and it succeeded.
  • Performed a Vite production build with npm run build and the build completed successfully with the service worker precache including the offline page.
  • Executed the test suite with npm test and all automated tests passed.

Codex Task

@Ivanx32 Ivanx32 merged commit 3f2e910 into main Mar 4, 2026
0 of 3 checks passed
@Ivanx32 Ivanx32 deleted the codex/analyze-pwa-deployment-issues branch March 4, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant