Skip to content

Commit 2b85156

Browse files
committed
Fix parcel service worker bundle
1 parent ec243ac commit 2b85156

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

core/lib/monogatari.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,8 +1182,9 @@ class Monogatari {
11821182
if (Monogatari.setting ('ServiceWorkers')) {
11831183
if (!Platform.electron () && !Platform.cordova () && Platform.serviceWorkers ()) {
11841184
// TODO: There's a place in hell for this quick fix, the splitting
1185-
// of the sw file is just preventing parcel from tryng to bundle it.
1186-
navigator.serviceWorker.register ('service-worker' + '.js').then ((registration) => {
1185+
// of the sw file is just preventing parcel from tryng to bundle it
1186+
// when building the core libraries.
1187+
navigator.serviceWorker.register ('./../service-worker' + '.js').then ((registration) => {
11871188
registration.onupdatefound = () => {
11881189
const worker = registration.installing;
11891190
worker.onstatechange = () => {

dist/engine/monogatari.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/engine/monogatari.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/service-worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const files = [
5050
];
5151

5252
self.addEventListener ('install', (event) => {
53+
self.skipWaiting ();
5354
event.waitUntil (
5455
caches.open (`${name}-v${version}`).then ((cache) => {
5556
return cache.addAll (files);

0 commit comments

Comments
 (0)