Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build Polishing + Service Worker Integration
Did some more debugging on the build setup, and realized a few more things that needed to be adjusted for things to work properly once I push everything up to GitHub Pages. I looked into moving the Service Worker to full TypeScript again, to which I realized it wasn't being included in the final app bundle because it isn't referenced anywhere by the module tree, since that's kind of true, it isn't statically referenced anywhere, because it's in it's own process, not part of the main thread. Looks like a possible fix for this could be to add the Service Worker file as a listed input source for Rollup, which can be configured with Vite's config options! https://joshuatz.com/posts/2021/strongly-typed-service-workers/ https://stackoverflow.com/questions/71355290/ (rediscovery :))prevent-service-worker-js-from-being-bundled-with-vite-rollup vitejs/vite#5081 Really happy things are working properly with this simple build step now! Only using TypeScript, plain ESM, and a bundler now! The full offline cached size for the whole minified site is only 59.6 kB, and it looks like thanks to dynamic imports, the Compression Streams API is also only polyfilled when the browser needs it, so that part of the site is skipped in caching if it doesn't need to be loaded, sick! The previous offline size was 154 kB. Looking into it, either way the polyfill is only cached if the browser doesn't support Compression Streams, so that's not specific to bundling afterall.
- Loading branch information