fix: the build runs under a subpath, not only at the domain root
base './' emits relative asset URLs; the manifest, the service-worker registration and sw.js's precache resolve against their own location; the four hardcoded /image literals turn relative. Verified headless under a simulated /edentext/ subpath: boots, types, SW scope correct.
This commit is contained in:
1 parent
b37261375a
commit
3ae8d27b26
7 files changed
+21
-17
No files matched your search
+1
-1
@@ -19,7 +19,7 @@ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ()
|
||||
// build over the one being edited.
|
||||
if (import.meta.env.PROD && 'serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/sw.js').catch(() => {});
|
||||
navigator.serviceWorker.register(`${import.meta.env.BASE_URL}sw.js`).catch(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user