-
Notifications
You must be signed in to change notification settings - Fork 6
/
next.config.js
executable file
·107 lines (106 loc) · 3.08 KB
/
next.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/** @type {import('next').NextConfig} */
// eslint-disable-next-line @typescript-eslint/no-var-requires
const withPWA = require('next-pwa')
module.exports = withPWA({
reactStrictMode: true,
pwa: {
dest: 'public',
register: true,
// swSrc: 'service-worker.js',
skipWaiting: true,
cacheOnFrontEndNav: true,
disable: process.env.NODE_ENV === 'development',
runtimeCaching: [
{
urlPattern: '/^https://fonts.googleapis.com/.*/i',
handler: 'CacheFirst',
options: {
cacheName: 'static-font-assets',
expiration: {
maxEntries: 4,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
},
},
// method: 'GET',
// strategyOptions: { cacheableResponse: { statuses: [0, 200] } },
},
{
urlPattern: /\.(?:mp4|webp)$/i,
handler: 'CacheFirst',
options: {
cacheName: 'static-video-assets',
expiration: {
maxEntries: 64,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 Days
},
},
},
{
urlPattern: '/^https://via.placeholder.com/*/i',
handler: 'CacheFirst',
options: {
cacheName: 'static-image-assets',
expiration: {
maxEntries: 4,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
},
},
// method: 'GET',
// strategyOptions: { cacheableResponse: { statuses: [0, 200] } },
},
{
urlPattern: '/^https://res.cloudinary.com/droidconke/*/i',
handler: 'CacheFirst',
options: {
cacheName: 'static-image-assets-1',
expiration: {
maxEntries: 4,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
},
},
// method: 'GET',
// strategyOptions: { cacheableResponse: { statuses: [0, 200] } },
},
{
urlPattern: '/^https://sessionize.com/image*/i',
handler: 'CacheFirst',
options: {
cacheName: 'static-img-assets',
expiration: {
maxEntries: 4,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
},
},
// method: 'GET',
// strategyOptions: { cacheableResponse: { statuses: [0, 200] } },
},
{
urlPattern: '/^https://lh3.googleusercontent.com/*/i',
handler: 'CacheFirst',
options: {
cacheName: 'static-images-assets',
expiration: {
maxEntries: 4,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
},
},
// method: 'GET',
// strategyOptions: { cacheableResponse: { statuses: [0, 200] } },
},
{
urlPattern: `/^${process.env.NEXT_PUBLIC_API_BASE_URL}/*/i`,
handler: 'NetworkFirst',
// handler: 'StaleWhileRevalidate',
// method: 'GET',
options: {
// cacheableResponse: { statuses: [0, 200, 201] },
cacheName: 'api-data-sets-1',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 7, // 7 days
},
},
},
],
},
})