-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
92 lines (89 loc) · 2.21 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
/** @type {import('next').NextConfig} */
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
cacheOnFrontEndNav: true,
aggressiveFrontEndNavCaching: true,
reloadOnOnline: true,
swcMinify: true,
disable: process.env.NODE_ENV === "development",
workboxOptions: {
disableDevLogs: true,
runtimeCaching: [
// Cache all main pages permanently
{
urlPattern: /^https:\/\/nextpgp\.vercel\.app\/$/,
handler: "NetworkFirst",
options: {
cacheName: "main-page-cache",
expiration: {
maxEntries: 1,
},
},
},
{
urlPattern: /^https:\/\/nextpgp\.vercel\.app\/generate$/,
handler: "NetworkFirst",
options: {
cacheName: "generate-page-cache",
expiration: {
maxEntries: 1,
},
},
},
{
urlPattern: /^https:\/\/nextpgp\.vercel\.app\/import$/,
handler: "NetworkFirst",
options: {
cacheName: "import-page-cache",
expiration: {
maxEntries: 1,
},
},
},
{
urlPattern: /^https:\/\/nextpgp\.vercel\.app\/encrypt$/,
handler: "NetworkFirst",
options: {
cacheName: "encrypt-page-cache",
expiration: {
maxEntries: 1,
},
},
},
{
urlPattern: /^https:\/\/nextpgp\.vercel\.app\/decrypt$/,
handler: "NetworkFirst",
options: {
cacheName: "decrypt-page-cache",
expiration: {
maxEntries: 1,
},
},
},
// Cache static assets (JS, CSS, images, fonts) permanently
{
urlPattern: ({ request }) =>
["style", "script", "worker"].includes(request.destination),
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-resources",
},
},
{
urlPattern: ({ request }) => request.destination === "image",
handler: "NetworkFirst",
options: {
cacheName: "image-cache",
},
},
],
},
});
const nextConfig = {
experimental: {
turbo: {
// ...
},
},
};
module.exports = withPWA(nextConfig);