diff --git a/build/webpack.prod.config.js b/build/webpack.prod.config.js index c51fb1d1..e5b5b774 100644 --- a/build/webpack.prod.config.js +++ b/build/webpack.prod.config.js @@ -57,11 +57,9 @@ module.exports = merge(baseWpConfig, { new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}]), new SWPrecacheWebpackPlugin({ cacheId: 'liberama', - dontCacheBustUrlsMatching: /\.\w{8}\./, filepath: `${publicDir}/service-worker.js`, minify: true, navigateFallback: '/index.html', - staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/], stripPrefix: publicDir, }), ] diff --git a/client/assets/sw-register.js b/client/assets/sw-register.js new file mode 100644 index 00000000..2cc39612 --- /dev/null +++ b/client/assets/sw-register.js @@ -0,0 +1,5 @@ +(function() { + if('serviceWorker' in navigator) { + navigator.serviceWorker.register('/service-worker.js'); + } +})(); diff --git a/client/index.html.template b/client/index.html.template index 15964dc2..5ae948ef 100644 --- a/client/index.html.template +++ b/client/index.html.template @@ -1,18 +1,12 @@
+