Repository navigation
Expand file tree
/
Copy pathnext.config.js
More file actions
105 lines (100 loc) · 2.39 KB
/
Copy pathnext.config.js
File metadata and controls
105 lines (100 loc) · 2.39 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
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
/** @type {import('next').NextConfig} */
const withPWA = require('next-pwa')({
dest: 'public',
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === 'development',
// Define runtime caching strategies
runtimeCaching: [
{
urlPattern: /^https:\/\/api\./i,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
expiration: {
maxEntries: 32,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
cacheableResponse: {
statuses: [200],
},
},
},
{
urlPattern: /^https:\/\/.*\.(css|js|png|jpg|jpeg|gif|svg|webp)$/i,
handler: 'CacheFirst',
options: {
cacheName: 'static-assets',
expiration: {
maxEntries: 60,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
{
urlPattern: /^https:\/\/fonts\.(googleapis|gstatic)\.com\//i,
handler: 'CacheFirst',
options: {
cacheName: 'google-fonts',
expiration: {
maxEntries: 20,
maxAgeSeconds: 365 * 24 * 60 * 60, // 1 year
},
cacheableResponse: {
statuses: [200],
},
},
},
{
urlPattern: /^https:\/\/(?:www\.)?mymemory\.translated\.net\//i,
handler: 'CacheFirst',
options: {
cacheName: 'translation-cache',
expiration: {
maxEntries: 50,
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
},
cacheableResponse: {
statuses: [200],
},
},
},
],
// Manifest settings
manifestOptions: {
name: 'KisanAI - Farmer Assistant',
short_name: 'KisanAI',
description: 'AI-powered farming assistant for Indian farmers',
start_url: '/',
display: 'standalone',
scope: '/',
theme_color: '#10b981',
background_color: '#ffffff',
screenshots: [
{
src: '/screenshot-540x720.png',
sizes: '540x720',
type: 'image/png',
form_factor: 'narrow',
},
{
src: '/screenshot-1280x720.png',
sizes: '1280x720',
type: 'image/png',
form_factor: 'wide',
},
],
},
// Workbox configuration
workboxOptions: {
disableDevLogs: true,
clientsClaim: true,
skipWaiting: true,
},
});
const nextConfig = {
/* config options here */
reactStrictMode: true,
turbopack: {},
};
module.exports = withPWA(nextConfig);