I’m developing a Flutter Web app, and every time I load the app, it downloads the canvaskit.wasm file, which is around 1.5 MB. Since this can significantly affect load times for users with slower internet connections, I’m wondering if there’s a way to cache this file and serve it locally or from a CDN, so the browser doesn’t need to download it on every page load.
I’ve tried looking into Flutter’s build configuration and the service worker settings, but I’m not sure how to approach this issue in the best way.
-
Can I configure the service worker (or any other caching mechanism) to cache canvaskit.wasm effectively?
-
How do browsers typically handle caching of .wasm files, and are there specific headers or strategies I should implement?
Any insights or examples would be much appreciated! Thanks.
2