consolidate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/15345/head
Michael Telatynski 2020-09-30 17:36:57 +01:00
parent 11e676cee0
commit aa2f3918cc
1 changed files with 1 additions and 4 deletions

View File

@ -39,15 +39,12 @@ export default class WebPlatform extends VectorBasePlatform {
// load service worker if available on this platform
if ('serviceWorker' in navigator) {
// clean up old dummy sw.js
navigator.serviceWorker.getRegistration('sw.js').then(reg => reg.unregister());
// Service worker is disabled in webpack-dev-server: https://github.com/GoogleChrome/workbox/issues/1790
if (!process.env.WEBPACK_DEV_SERVER) {
navigator.serviceWorker.register('service-worker.js');
} else {
// we no longer run workbox when in webpack-dev-server, clean it up
navigator.serviceWorker.getRegistration('service-worker.js').then(reg => reg.unregister());
navigator.serviceWorker.getRegistration().then(reg => reg && reg.unregister());
}
}
}