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
Fresh service worker #982
Comments
|
I tried creating a Fresh plugin the other day to support serving a Fresh app offline via a service worker. I got blocked by service workers not supporting 2 things:
I think top-level After realizing that I wanted to experiment with what a solution might look like so I rolled something more basic than Fresh but works offline: https://github.com/mfulton26/offline-mpa/. It is server-side rendered but instead of islands I'm doing full page hydration for simplicity but the idea should be the same. Almost all the code is reused between the server and the service worker. The main differences are that the server bundles JS on-demand while the service worker pre-downloads those bundles, caches them, and then serves those from the cache. Can a similar pattern to what I was able to get working in my |
|
The new ahead-of-time builds should be usable as a manifest for a service worker. I feel like Fresh is already in a pretty close state to supporting offline apps. I think if any Lack of official offline support is the main blocker for my team and me to using Fresh at work. @marvinhagemeister, do you think offline support as an official plugin aligns with Fresh's vision/scope/etc.? How might we get such prioritized? I can try doing a PR myself but I'm not confident in my familiarity with the codebase, etc. |
|
So far the interest in offline support is very low compared to all the other features. That's why it's not on the roadmap. I'm definitely open to accepting PRs if folks want to put in the work for that. |
Service workers could save a ton of server load. Fortunately, Fresh has all the information needed to automatically generate a meaningful service worker: routes, assets, bundles…
I'm here to request that Fresh integrated service workers out of the box 😅
SW could cache…
static/Seems like there's an opportunity here to both makes Fresh projects faster and reduce server and cdn loads.
The text was updated successfully, but these errors were encountered: