ekeijl / todomvc-htm-preact

Todo application using HTM and Preact
Other
9 stars 2 forks source link

PWA Usage #1

Open badpenguin opened 1 year ago

badpenguin commented 1 year ago

Did you had look trying to use all the libraries offline? I wish to build a PWA and need to have the files locally to be served and cached by a service worker.

ekeijl commented 1 year ago

That's a cool idea, I'll look into it.

ekeijl commented 1 year ago

Adding PWA capabilities was relatively easy, but there are some caveats:

I tested it in Edge and I could install the app on Windows as a desktop application. After setting the app in 'Offline mode' in the dev tools, all files were served from the service worker.

badpenguin commented 1 year ago

Ah sorry maybe I didn't explained myself pretty good :) The problems are the import from the CDN, there is no guarantee that all of them gets cached by the service worker using a cache strategy. Also I don't love to cache unpredictable 3thy party resources :) I wish to have all the files locally.

Meanwhile I found this one that allows me to create a single offline bundle with all the libraries that I use: https://github.com/mujahidfa/preact-htm-signals-standalone