-
Notifications
You must be signed in to change notification settings - Fork 511
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
Suggestion: serviceWorker.register path and routes issue #187
Comments
downset13
changed the title
Bug Report: serviceWorker.register path and routes issue
Suggestion: serviceWorker.register path and routes issue
May 18, 2018
I am with this issue right now, how can I fix this? |
Sorry, I read again your comment, thanks for information :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: