Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix PWA asset paths #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix PWA asset paths #168

wants to merge 1 commit into from

Conversation

gergelyk
Copy link

I noticed that app shell isn't correctly cached by the service worker. Consequently PWA doesn't start correctly.

Steps to reproduce

  • Build and serve the app: trunk serve
  • Open app in the browser (chromium)
  • Click "Install egui Template PWA"
  • Close PWA
  • Stop the server (trunk)
  • Start previously installed PWA

Proposed solution

  1. trunkrs adds hashes to the file names: eframe_template-*. This makes paths in sw.js under filesToCache invalid. I solved it by adding filehash = false. The other option could be generating sw.js with correct filenames in post_build hook of trunkrs.
  2. I noticed that when manifest.json is served from assets/, then installed PWA starts from attempting to read assets/index.html from cache. The file is non-existing, so startup fails. I solved it by moving manifest.json to the root directory. This required relative paths in manifest.json to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant