Merge pull request #834 from cdr/fix-sw-path

Fix service worker path
This commit is contained in:
Dean Sheather 2019-07-08 22:36:27 +00:00 committed by GitHub
commit 79e08c74ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -29,7 +29,7 @@
if ("serviceWorker" in navigator) {
// Use the window load event to keep the page load performant
window.addEventListener("load", () => {
navigator.serviceWorker.register("/service-worker.js");
navigator.serviceWorker.register('service-worker.js', {scope: './'});
});
}
</script>

View File

@ -68,6 +68,7 @@ module.exports = (options = {}) => merge(
})
].concat(prod ? [
new GenerateSW({
importWorkboxFrom: "local",
include: [cachePattern],
runtimeCaching: [{
urlPattern: cachePattern,