From 4b146c70ad7378c85c8bb525411b33359d6697b1 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sun, 8 Mar 2020 18:53:40 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B9=20=D1=80?= =?UTF-8?q?=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/webpack.prod.config.js | 2 -- client/assets/sw-register.js | 5 +++++ client/index.html.template | 10 ++-------- 3 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 client/assets/sw-register.js 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 @@ + - - +