Skip to content

fix: register service worker with a relative path#10

Open
arnaudvalle wants to merge 1 commit intomasterfrom
fix/service-worker-registration
Open

fix: register service worker with a relative path#10
arnaudvalle wants to merge 1 commit intomasterfrom
fix/service-worker-registration

Conversation

@arnaudvalle
Copy link
Collaborator

If the app is run in a sub folder (like it is now with github pages), then it was pointing to a service worker in the root folder of the domain rather than the current folder of the app (i.e. /grejbox/)

Fixing error message when launching the app:

Uncaught (in promise) TypeError: ServiceWorker script at https://mcastagnetti.github.io/sw.js for scope https://mcastagnetti.github.io/ encountered an error during installation.

Test:

  • Launch the app
  • There should be no error message

If the app is run in a sub folder (like it is now with github pages), then it was pointing to a service worker in the root folder of the domain rather than the current folder of the app (i.e. /grejbox/)
@arnaudvalle arnaudvalle added the bug Something isn't working label Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant