correct SW field

config.sw should point to uv.sw.js, not the stock sw.js
we now use a fixed path in register-sw.js
This commit is contained in:
David Reed 2022-12-03 15:51:18 -05:00
parent 9fa709d98f
commit d75d7fde3a
No known key found for this signature in database
GPG key ID: 2211691D8A1EE72F
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,9 @@
"use strict";
/**
* Distributed with Ultraviolet and compatible with most configurations.
*/
const stockSW = "/uv/sw.js";
/**
* Global util
* Used in 404.html and index.html
@ -7,7 +12,8 @@ async function registerSW() {
if (!navigator.serviceWorker)
throw new Error("Your browser doesn't support service workers.");
await navigator.serviceWorker.register(__uv$config.sw, {
// Ultraviolet has a stock `sw.js` script.
await navigator.serviceWorker.register(stockSW, {
scope: __uv$config.prefix,
});
}

View file

@ -8,5 +8,5 @@ self.__uv$config = {
handler: "/uv/uv.handler.js",
bundle: "/uv/uv.bundle.js",
config: "/uv/uv.config.js",
sw: "/uv/sw.js",
sw: "/uv/uv.sw.js",
};