You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: When using Vue Router (or any routes), reloading any page that is not the root path will cause ServiceWorkerContainer to try and register the service worker 'service-worker.js' relative to the current path. This not only throws console errors and failed service worker installs, but seems to have the unintended consequence of breaking precache busting.
Suggested Fix: As this is a template, one would expect the boilerplate to cover as many bases as possible. Simply change Line 19 to navigator.serviceWorker.register('/service-worker.js')
EDIT: Just noticed this is discussed in PR #80. Merge is blocked as this solution won't work if the project root is not the domain root. That being said, I'd consider that to be less likely a scenario than a project at the root with subroutes. If that's not agreeable, might I recommend adding a note in the documentation to configure the service worker registration?
Thanks!
The text was updated successfully, but these errors were encountered:
downset13
changed the title
Bug Report: serviceWorker.register path and routes issue
Suggestion: serviceWorker.register path and routes issue
May 18, 2018
File: build/service-worker-prod.js
Line: 19
navigator.serviceWorker.register('service-worker.js')
Issue: When using Vue Router (or any routes), reloading any page that is not the root path will cause ServiceWorkerContainer to try and register the service worker 'service-worker.js' relative to the current path. This not only throws console errors and failed service worker installs, but seems to have the unintended consequence of breaking precache busting.
Suggested Fix: As this is a template, one would expect the boilerplate to cover as many bases as possible. Simply change Line 19 to
navigator.serviceWorker.register('/service-worker.js')
EDIT: Just noticed this is discussed in PR #80. Merge is blocked as this solution won't work if the project root is not the domain root. That being said, I'd consider that to be less likely a scenario than a project at the root with subroutes. If that's not agreeable, might I recommend adding a note in the documentation to configure the service worker registration?
Thanks!
The text was updated successfully, but these errors were encountered: