-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.renderer.additions.js
48 lines (47 loc) · 1.59 KB
/
webpack.renderer.additions.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
43
44
45
46
47
48
const WorkboxPlugin = require('workbox-webpack-plugin')
module.exports = {
plugins: [
new WorkboxPlugin.GenerateSW({
// Do not precache anything (service worker will fail fetching file protocol which electron uses in production)
exclude: [/[\s\S]*/],
// Define runtime caching rules.
runtimeCaching: [{
// Match any request that ends with .png, .jpg, .jpeg or .svg.
urlPattern: /\.(?:png|jpg|jpeg|svg)$/,
// Apply a cache-first strategy.
handler: 'CacheFirst',
options: {
cacheName: 'images',
// Only cache 10 images.
expiration: {
maxEntries: 64,
maxAgeSeconds: 60 * 15
},
},
},
{
// match any LCLPNetwork request and cache it
urlPattern: /https:\/\/(www\.)?([-a-zA-Z0-9@:%._\+~#=]+\.)?lclpnet\.work\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/,
handler: 'CacheFirst',
options: {
cacheName: 'backend',
expiration: {
maxAgeSeconds: 30,
maxEntries: 1024
}
}
}],
}),
],
module: {
rules: [
{
test: /logo\.(ico)$/i,
loader: 'file-loader',
options: {
name: '[name].[ext]',
},
},
],
},
}