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
This commit is contained in:
David Lechner
2022-07-28 11:44:59 -05:00
parent e3fece1517
commit 30314db086
2 changed files with 6 additions and 3 deletions
+5
View File
@@ -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
+1 -3
View File
@@ -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 &&