From 07384e1388cfa899f7a844cb9bfca205210d1d88 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Thu, 3 Aug 2017 00:00:09 -0700 Subject: [PATCH 1/2] Avoid caching the service worker --- config/webpack.js | 2 +- src/.htaccess | 12 ++++++++++++ src/index.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/config/webpack.js b/config/webpack.js index 536185b809..80db09afc3 100644 --- a/config/webpack.js +++ b/config/webpack.js @@ -264,7 +264,7 @@ module.exports = (env) => { 'return.html', ], // swSrc: './src/sw.js', - swDest: './dist/sw.js' + swDest: './dist/service-worker.js' })); } diff --git a/src/.htaccess b/src/.htaccess index 099d377e74..35299620f2 100644 --- a/src/.htaccess +++ b/src/.htaccess @@ -958,3 +958,15 @@ FileETag None + +# Do not cache the service worker! + + + FileETag None + + Header unset ETag + Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" + Header set Pragma "no-cache" + Header unset Expires + + \ No newline at end of file diff --git a/src/index.js b/src/index.js index 302d431f48..cf7cad063a 100644 --- a/src/index.js +++ b/src/index.js @@ -33,7 +33,7 @@ require('./app/shell/dimManifestProgress.directive'); require('./scss/main.scss'); if ($DIM_FLAVOR !== 'dev' && navigator.serviceWorker) { - navigator.serviceWorker.register('/sw.js') + navigator.serviceWorker.register('/service-worker.js') .catch((err) => { console.error('Unable to register service worker.', err); }); From cc9172a60a43dd4be741048b02798bfae1c1f89d Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Thu, 3 Aug 2017 00:07:23 -0700 Subject: [PATCH 2/2] Add no-javascript help text. --- src/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index 57ae039563..ac38c18957 100644 --- a/src/index.html +++ b/src/index.html @@ -34,7 +34,9 @@ - + + DIM hasn't loaded. Something may be wrong with it, or with your browser (maybe you have a content blocker, or have disabled JavaScript). Try force reloading to make sure (Ctrl-F5 or Cmd-R). +