-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
69 lines (67 loc) · 1.53 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
const withPWA = require("@ducanh2912/next-pwa").default({
cacheOnFrontEndNav: true,
aggressiveFrontEndNavCaching: true,
reloadOnOnline: true,
swcMinify: true,
workboxOptions: {
disableDevLogs: true,
},
dest: "public",
register: true,
skipWaiting: true,
sw: "sw.js",
runtimeCaching: [
{
urlPattern: /^https?.*\.html$/,
handler: "NetworkFirst",
options: {
cacheName: "html-cache",
expiration: {
maxEntries: 50,
maxAgeSeconds: 7 * 24 * 60 * 60,
},
},
},
{
urlPattern: /\.(?:js|css|ts|tsx)$/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-resources",
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60,
},
},
},
{
urlPattern: /^https?.*\/images\/.*\.(?:png|jpg|jpeg|svg|gif|webp|pdf)$/,
handler: "CacheFirst",
options: {
cacheName: "image-cache",
expiration: {
maxEntries: 100,
maxAgeSeconds: 60 * 24 * 60 * 60,
},
},
},
{
urlPattern: /\.(?:woff|woff2|ttf|eot)$/,
handler: "CacheFirst",
options: {
cacheName: "font-cache",
expiration: {
maxEntries: 30,
maxAgeSeconds: 60 * 24 * 60 * 60,
},
},
},
],
});
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV !== "development",
},
};
module.exports = withPWA(nextConfig);