forked from Invoice-Liquidity-Network/ILN-Frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
73 lines (71 loc) · 1.73 KB
/
Copy pathnext.config.ts
File metadata and controls
73 lines (71 loc) · 1.73 KB
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
import type { NextConfig } from "next";
// @ts-ignore
import withPWA from "next-pwa";
const nextConfig: NextConfig & { allowedDevOrigins?: string[] } = {
reactStrictMode: true,
turbopack: {},
allowedDevOrigins: ["127.0.0.1", "localhost"],
};
export default withPWA({
dest: "public",
register: true,
skipWaiting: true,
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts",
expiration: {
maxEntries: 4,
maxAgeSeconds: 365 * 24 * 60 * 60, // 365 days
},
},
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-static",
expiration: {
maxEntries: 4,
maxAgeSeconds: 365 * 24 * 60 * 60, // 365 days
},
},
},
{
urlPattern: /\.(?:js|css|woff|woff2|ttf|eot)$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-assets",
expiration: {
maxEntries: 64,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
{
urlPattern: /\/api\/.*$/i,
handler: "NetworkFirst",
options: {
cacheName: "api-cache",
expiration: {
maxEntries: 16,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
networkTimeoutSeconds: 10,
},
},
{
urlPattern: ({ request }: any) => request.destination === "document",
handler: "NetworkFirst",
options: {
cacheName: "pages",
expiration: {
maxEntries: 32,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
],
})(nextConfig);