From 30314db086668980f552c977cd440ca8ce337538 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 28 Jul 2022 11:44:59 -0500 Subject: [PATCH] webpack: fix main.[hash].js not cached This caused updates to not work if main.js was not in the browser cache since it was being excluded from the service worker. Issue: https://github.com/pybricks/support/issues/689 --- CHANGELOG.md | 5 +++++ config/webpack.config.js | 4 +--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9973a0..0a403985 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ## [Unreleased] +### Fixed +- Fixed `main.[hash].js` not cached ([support#689]). + +[support#689]: https://github.com/pybricks/support/issues/689 + ## [2.0.0-beta.4] - 2022-07-28 ### Added diff --git a/config/webpack.config.js b/config/webpack.config.js index 7a6daf6d..5174e1c0 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -716,12 +716,10 @@ module.exports = function (webpackEnv) { new WorkboxWebpackPlugin.InjectManifest({ swSrc, dontCacheBustURLsMatching: /\.[0-9a-f]{8}\./, - // REVISIT: main entry point should be chunked instead of ignored - exclude: [/\.map$/, /asset-manifest\.json$/, /LICENSE/, /static\/js\/main\.\w+\.js$/], // Bump up the default maximum size (2mb) that's precached, // to make lazy-loading failure scenarios less likely. // See https://github.com/cra-template/pwa/issues/13#issuecomment-722667270 - maximumFileSizeToCacheInBytes: 2 * 1024 * 1024, + maximumFileSizeToCacheInBytes: 10 * 1024 * 1024, }), // TypeScript type checking useTypeScript &&