-
Notifications
You must be signed in to change notification settings - Fork 2
/
workbox-config.js
42 lines (41 loc) · 1.13 KB
/
workbox-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module.exports = {
// a directory should be the same as "reactSnap.destination",
// which default value is `build`
globDirectory: "build/",
globPatterns: [
"static/css/*.css",
"static/js/*.js",
"shell.html",
"index.html"
],
// there is "reactSnap.include": ["/shell.html"] in package.json
navigateFallback: "/shell.html",
// Ignores URLs starting from /__ (useful for Firebase):
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
navigateFallbackAllowlist: [/^(?!\/__).*/],
// configuration specific to this experiment
runtimeCaching: [
{
urlPattern: /\.(?:png|jpg|jpeg|svg|webp)$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'images'
}
},
{
urlPattern: /\.(?:js)$/,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'scripts'
}
},
{
urlPattern: /api/,
handler: "StaleWhileRevalidate"
}
],
swDest: 'build/service-worker.js',
globIgnores: [
"../workbox-config.js"
]
};