-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathnext.config.ts
More file actions
68 lines (66 loc) · 1.57 KB
/
next.config.ts
File metadata and controls
68 lines (66 loc) · 1.57 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
import type { NextConfig } from "next";
import withPWA from "next-pwa";
const nextConfig: NextConfig = {
turbopack: {}, // Silence Turbopack warning for webpack-based next-pwa
experimental: {
serverActions: {
bodySizeLimit: '5mb',
},
},
};
export default withPWA({
dest: 'public',
register: true,
skipWaiting: true,
disable: false, // Enable in dev for testing
fallbacks: {
document: '/_offline.html',
},
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.(?:gstatic|googleapis)\.com\/.*/i,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts',
expiration: {
maxEntries: 4,
maxAgeSeconds: 365 * 24 * 60 * 60, // 1 year
},
},
},
{
urlPattern: /^https:\/\/api\.github\.com\/.*/i,
handler: 'NetworkFirst',
options: {
cacheName: 'github-api',
networkTimeoutSeconds: 10,
expiration: {
maxEntries: 50,
maxAgeSeconds: 5 * 60, // 5 minutes
},
},
},
{
urlPattern: /\.(?:png|jpg|jpeg|svg|gif|webp|ico)$/i,
handler: 'CacheFirst',
options: {
cacheName: 'static-images',
expiration: {
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
{
urlPattern: /\.(?:js|css)$/i,
handler: 'StaleWhileRevalidate',
options: {
cacheName: 'static-resources',
expiration: {
maxEntries: 100,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
],
})(nextConfig);