diff --git a/app/soapbox/main.tsx b/app/soapbox/main.tsx index 9505ae07a..9347d796c 100644 --- a/app/soapbox/main.tsx +++ b/app/soapbox/main.tsx @@ -31,7 +31,15 @@ function main() { if (BuildConfig.NODE_ENV === 'production') { // avoid offline in dev mode because it's harder to debug - OfflinePluginRuntime.install(); + // https://github.com/NekR/offline-plugin/pull/201#issuecomment-285133572 + OfflinePluginRuntime.install({ + onUpdateReady: function() { + OfflinePluginRuntime.applyUpdate(); + }, + onUpdated: function() { + window.location.reload(); + }, + }); } perf.stop('main()'); }); diff --git a/webpack/production.js b/webpack/production.js index 18666a109..c90decd4e 100644 --- a/webpack/production.js +++ b/webpack/production.js @@ -85,6 +85,7 @@ module.exports = merge(sharedConfig, { ServiceWorker: { cacheName: 'soapbox', entry: join(__dirname, '../app/soapbox/service_worker/entry.ts'), + events: true, minify: true, }, cacheMaps: [{