diff --git a/package.json b/package.json index 9526c22bf..bb1440bea 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "webpack-dev-server": "^3.11.0", "webpack-merge": "^4.2.2", "webpack-stream": "^6.1.1", - "workbox-core": "^5.1.4", "workbox-webpack-plugin": "^5.1.4", "worker-plugin": "^5.0.0" }, @@ -91,7 +90,9 @@ "sortablejs": "^1.12.0", "swiper": "^6.3.5", "webcomponents.js": "^0.7.24", - "whatwg-fetch": "^3.5.0" + "whatwg-fetch": "^3.5.0", + "workbox-core": "^5.1.4", + "workbox-precaching": "^5.1.4" }, "babel": { "presets": [ diff --git a/src/serviceworker.js b/src/serviceworker.js index 49ae921b7..97357a8a5 100644 --- a/src/serviceworker.js +++ b/src/serviceworker.js @@ -1,7 +1,9 @@ /* eslint-env serviceworker */ -/* eslint-disable-next-line import/namespace,import/named */ +/* eslint-disable import/namespace,import/named */ import { skipWaiting, clientsClaim } from 'workbox-core'; +import { precacheAndRoute } from 'workbox-precaching'; +/* eslint-enable import/namespace,import/named */ skipWaiting(); clientsClaim(); @@ -43,6 +45,5 @@ self.addEventListener('notificationclick', function (event) { }, false); // this is needed by the webpack Workbox plugin -// this plugin is not fully supported in webpack v5. pecaching is disabled until version 6 of this plugin is released /* eslint-disable-next-line no-restricted-globals,no-undef */ -//workbox.precaching.precacheAndRoute(self.__WB_MANIFEST); +precacheAndRoute(self.__WB_MANIFEST);