Skip to content

Commit 3d76514

Browse files
committed
Revert "[WIP] Sandbox service worker changes (#818)"
This reverts commit 0434b4b.
1 parent 4f4b570 commit 3d76514

File tree

1 file changed

+6
-30
lines changed

1 file changed

+6
-30
lines changed

packages/app/config/webpack.prod.js

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -128,32 +128,16 @@ module.exports = merge(commonConfig, {
128128
},
129129
minify: true,
130130
// For unknown URLs, fallback to the index page
131-
staticFileGlobs: [], // don't pre-cache anything
131+
navigateFallback: 'https://new.codesandbox.io/frame.html',
132+
staticFileGlobs: ['www/frame.html'],
133+
stripPrefix: 'www/',
132134
// Ignores URLs starting from /__ (useful for Firebase):
133135
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
136+
navigateFallbackWhitelist: [/^(?!\/__).*/],
134137
// Don't precache sourcemaps (they're large) and build asset manifest:
138+
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
135139
maximumFileSizeToCacheInBytes: 5242880,
136-
directoryIndex: false,
137-
verbose: true,
138140
runtimeCaching: [
139-
{
140-
urlPattern: /^https:\/\/\w+\.codesandbox\.\w+\/$/, // request to /
141-
handler: 'networkFirst',
142-
options: {
143-
debug: true,
144-
},
145-
},
146-
{
147-
urlPattern: /\.worker\.js$/,
148-
handler: 'cacheFirst',
149-
options: {
150-
cache: {
151-
maxEntries: 50,
152-
name: 'workers-cache',
153-
},
154-
debug: true,
155-
},
156-
},
157141
{
158142
urlPattern: /api\/v1\/sandboxes/,
159143
handler: 'networkFirst',
@@ -162,7 +146,6 @@ module.exports = merge(commonConfig, {
162146
maxEntries: 50,
163147
name: 'sandboxes-cache',
164148
},
165-
debug: true,
166149
},
167150
},
168151
{
@@ -173,21 +156,19 @@ module.exports = merge(commonConfig, {
173156
maxAgeSeconds: 60 * 60 * 24,
174157
name: 'dependency-version-cache',
175158
},
176-
debug: true,
177159
},
178160
},
179161
{
180162
// These should be dynamic, since it's not loaded from this domain
181163
// But from the root domain
182-
urlPattern: /codesandbox\.\w+\/static\/(js|browserfs)\//,
164+
urlPattern: /codesandbox\.io\/static\/js\//,
183165
handler: 'fastest',
184166
options: {
185167
cache: {
186168
// A day
187169
maxAgeSeconds: 60 * 60 * 24,
188170
name: 'static-root-cache',
189171
},
190-
debug: true,
191172
},
192173
},
193174
{
@@ -199,7 +180,6 @@ module.exports = merge(commonConfig, {
199180
maxAgeSeconds: 60 * 60 * 24 * 7,
200181
name: 'dependency-url-generator-cache',
201182
},
202-
debug: true,
203183
},
204184
},
205185
{
@@ -210,7 +190,6 @@ module.exports = merge(commonConfig, {
210190
maxAgeSeconds: 60 * 60 * 24 * 7,
211191
name: 'dependency-files-cache',
212192
},
213-
debug: true,
214193
},
215194
},
216195
{
@@ -222,7 +201,6 @@ module.exports = merge(commonConfig, {
222201
name: 'unpkg-dep-cache',
223202
maxAgeSeconds: 60 * 60 * 24 * 7,
224203
},
225-
debug: true,
226204
},
227205
},
228206
{
@@ -234,7 +212,6 @@ module.exports = merge(commonConfig, {
234212
name: 'jsdelivr-dep-cache',
235213
maxAgeSeconds: 60 * 60 * 24 * 7,
236214
},
237-
debug: true,
238215
},
239216
},
240217
{
@@ -246,7 +223,6 @@ module.exports = merge(commonConfig, {
246223
name: 'cloudflare-cache',
247224
maxAgeSeconds: 60 * 60 * 24 * 7,
248225
},
249-
debug: true,
250226
},
251227
},
252228
],

0 commit comments

Comments
 (0)