diff --git a/bundles/org.openhab.ui/web/build/webpack.config.js b/bundles/org.openhab.ui/web/build/webpack.config.js index 519e72c66..f30951807 100644 --- a/bundles/org.openhab.ui/web/build/webpack.config.js +++ b/bundles/org.openhab.ui/web/build/webpack.config.js @@ -265,9 +265,13 @@ module.exports = { ] }), ...(env === 'production' ? [ - new WorkboxPlugin.InjectManifest({ - swSrc: resolvePath('src/service-worker.js'), + new WorkboxPlugin.GenerateSW({ + swDest: 'service-worker.js', maximumFileSizeToCacheInBytes: 100000000, + // these options encourage the ServiceWorkers to get in there fast + // and not allow any straggling "old" SWs to hang around + clientsClaim: true, + skipWaiting: true }) ] : []), ...(env === 'production' ? [ diff --git a/bundles/org.openhab.ui/web/jsconfig.json b/bundles/org.openhab.ui/web/jsconfig.json index 83ffa8d91..d84deff92 100644 --- a/bundles/org.openhab.ui/web/jsconfig.json +++ b/bundles/org.openhab.ui/web/jsconfig.json @@ -3,7 +3,7 @@ "allowSyntheticDefaultImports": false, "baseUrl": "./", "paths": { - "@/*": ["src/*"], + "@/*": ["src/*"] } }, "exclude": ["node_modules", "node", "build", "assets-src", "www", "test"] diff --git a/bundles/org.openhab.ui/web/src/components/app.vue b/bundles/org.openhab.ui/web/src/components/app.vue index 84b93b4e5..bf821ff0c 100644 --- a/bundles/org.openhab.ui/web/src/components/app.vue +++ b/bundles/org.openhab.ui/web/src/components/app.vue @@ -326,7 +326,7 @@ export default { // Register service worker serviceWorker: (location.hostname === 'localhost') ? {} : { - path: '/service-worker.js' + path: './service-worker.js' }, card: { swipeToClose: true diff --git a/bundles/org.openhab.ui/web/src/service-worker.js b/bundles/org.openhab.ui/web/src/service-worker.js deleted file mode 100644 index 0e336e2b3..000000000 --- a/bundles/org.openhab.ui/web/src/service-worker.js +++ /dev/null @@ -1,3 +0,0 @@ -// manifest import and workbox imports will be autogenerated by webpack -// eslint-disable-next-line no-undef -workbox.precaching.precacheAndRoute(self.__WB_MANIFEST)