Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7965 from EtherealEngine/bugfix/pwa-registration
Browse files Browse the repository at this point in the history
Manually reg sw on production.
  • Loading branch information
jerknose authored May 4, 2023
2 parents 3314c2c + c032554 commit 0d01f07
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 887 deletions.
16 changes: 16 additions & 0 deletions packages/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@
<script>
var global = globalThis
var exports = { __esModule: true }
// Don't register on service worker on dev
if ("serviceWorker" in navigator && '<%- swScriptLink %>' !== '') {
if (navigator.serviceWorker.controller) {
console.log("[PWA] Existing sw found at ", navigator.serviceWorker.controller.scriptURL);
} else {
console.log('[PWA] Registering sw at <%- swScriptLink %>')
// Register the service worker
navigator.serviceWorker
.register("<%- swScriptLink %>", {
scope: "./"
})
.then(function (reg) {
console.log("[PWA] SW registered at " + reg.scope);
});
}
}
</script>
</head>
<body>
Expand Down
Loading

0 comments on commit 0d01f07

Please sign in to comment.