Skip to content

Commit c03e2ca

Browse files
authored
Remove service worker rule (#5925)
* Remove service worker rule * Remove console.error
1 parent 2883aa9 commit c03e2ca

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

packages/app/config/webpack.prod.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,18 @@ module.exports = merge(commonConfig, {
242242
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
243243
maximumFileSizeToCacheInBytes: 1024 * 1024 * 20, // 20mb
244244
runtimeCaching: [
245-
{
246-
urlPattern: /api\/v1\//,
247-
handler: 'networkFirst',
248-
options: {
249-
cache: {
250-
maxEntries: 50,
251-
name: 'sandboxes-cache',
252-
},
253-
},
254-
},
245+
// Don't do this, because it will cache API responses to the server. Even if no-cache headers
246+
// are set.
247+
// {
248+
// urlPattern: /api\/v1\//,
249+
// handler: 'networkFirst',
250+
// options: {
251+
// cache: {
252+
// maxEntries: 50,
253+
// name: 'sandboxes-cache',
254+
// },
255+
// },
256+
// },
255257
{
256258
urlPattern: /api\/v1\/dependencies/,
257259
handler: 'fastest',
@@ -296,6 +298,18 @@ module.exports = merge(commonConfig, {
296298
},
297299
},
298300
},
301+
// We resolve `package.json` to resolve versions (e.g. next -> 15.0.5). We need to have a much shorter cache on this
302+
{
303+
urlPattern: /^https:\/\/unpkg\.com\/.*\/package.json/,
304+
handler: 'networkFirst',
305+
options: {
306+
cache: {
307+
maxEntries: 300,
308+
name: 'unpkg-dep-pkg-cache',
309+
maxAgeSeconds: 60 * 5, // 5 minutes
310+
},
311+
},
312+
},
299313
{
300314
urlPattern: /^https:\/\/unpkg\.com/,
301315
handler: 'cacheFirst',

0 commit comments

Comments
 (0)