Skip to content
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

Open
downset13 opened this issue May 18, 2018 · 2 comments
Open

Suggestion: serviceWorker.register path and routes issue #187

downset13 opened this issue May 18, 2018 · 2 comments

Comments

@downset13
Copy link

downset13 commented 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!

@downset13 downset13 changed the title Bug Report: serviceWorker.register path and routes issue Suggestion: serviceWorker.register path and routes issue May 18, 2018
@rof20004
Copy link

I am with this issue right now, how can I fix this?

@rof20004
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants