Flutter automatically generates a service worker flutter_service_worker.js when building for the web but I would like to add my own fetch/caching rules for third-party routes.
How can I achieve that ?
Flutter automatically generates a service worker flutter_service_worker.js when building for the web but I would like to add my own fetch/caching rules for third-party routes.
How can I achieve that ?
So far the only workaround that I have found is to make a script that post-processes the generated flutter_service_worker.js and replaces:
if (!RESOURCES[key]) {
return;
}
by
if (!RESOURCES[key]) {
return customFetch();
}
where customFetch() implements my own caching rules.