-
Notifications
You must be signed in to change notification settings - Fork 389
importScripts are cached forever #225
Comments
As of right now, you're responsible for configuring the HTTP cache directives used by your web server when responding to requests for URLs listed in This behavior is due to the way the browser deals with the underlying That being said, the maintainers of the service worker specific have realized that obeying HTTP cache directives for service worker scripts can be problematic, especially in hosting scenarios that don't give developers control of configuring them. There has just been a change made to the service worker specification that will prevent both the main service worker script as well as anything pulled in from Neither Firefox nor Chrome have shipped a version of their browsers that adhere to the new behavior yet, but both are working on it. Given that there's a solution that will be generally available in the future, I don't think it makes sense to modify |
My push handler, web workers and toolbox etc are part of my service worker and should be reloaded when there is a service worker update. Because of the design of swPrecache the only way to modify the service worker output is to override the template file which isn't easy to maintain. A simple option to inline some files into your service worker would make swPrecahe much easier to work with as everyone is going to want to add a push handler and get caught by this gotcha. Anyways appreciate your response. |
If you serve the Inlining the files listed in |
Ok good to know a solution is in the works. For my use case I need to modify the service worker so I need to override the template file and each time you make a release I need to merge my changes back in. I wasn't suggesting to change importScripts just to add a new option to load some scripts into the service worker to avoid overriding the template files. Thanks for the info on the http cache. |
When I push a new version of the service worker, it gets updated but it doesn't reload any changes in files imported via ImportScripts.
Maybe there should be a feature to load scripts and inline them into the service-worker.js when swPrecache is building instead of using ImportScripts that i assume rely on browser caching mechanism?
The text was updated successfully, but these errors were encountered: