-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clarification on how to deactivate the cache in development #84
Comments
I finally found my way around this. It works by adding "#dev" to the filename of "index.html" at the root folder. In order to Trunk to still find the template, we must also update Trunk.toml: target = "index.html#dev" If you navigator has already cached your app, you must delete the cache manually. Do you think it’s worth adding this to the README ? |
you should add It might be worth specifying this in the README. Although, i would prefer if we don't have any caching at all or if it was actively opt-in. |
The above method is useful and works for me. Here is the summary. |
If you want to disable the caching forever, the best method is to just delete (or comment out) <!--Register Service Worker. this will cache the wasm / js scripts for offline use (for PWA functionality). -->
<!-- Force refresh (Ctrl + F5) to load the latest files instead of cached files -->
<script>
// We disable caching during development so that we always view the latest version.
if ('serviceWorker' in navigator && window.location.hash !== "#dev") {
window.addEventListener('load', function () {
navigator.serviceWorker.register('sw.js');
});
}
</script> from the |
Note, the cache was disabled in #102, so this issue can be closed. In fact, the service-worker currently does nothing but throw harmless errors. |
In the ReadMe you have mentioned
Please could you indicate where to add the
#dev
. Should I add it to thefilesToCache
variable inside thesw.js
, should i rename theindex.html
at the root folder or should I append it to the content ofindex.html
at the root folder.Sorry if my question seems dumb
The text was updated successfully, but these errors were encountered: