forked from Dipanita45/HEALCONNECT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
53 lines (51 loc) · 1.33 KB
/
next.config.js
File metadata and controls
53 lines (51 loc) · 1.33 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
/** @type {import('next').NextConfig} */
const withPWA = require('next-pwa')({
dest: 'public',
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === 'development',
runtimeCaching: [
{
// Cache Next.js static assets
urlPattern: /^\/_next\/.*/i,
handler: 'StaleWhileRevalidate',
options: { cacheName: 'next-assets' },
},
{
// Cache API requests and dynamic data
urlPattern: /^https:\/\/your-api-domain\.com\/.*/i, // Replace with your API domain
handler: 'NetworkFirst', // Try network first, fallback to cache if offline
options: {
cacheName: 'api-data',
networkTimeoutSeconds: 10, // fallback to cache if network takes too long
expiration: { maxEntries: 50, maxAgeSeconds: 24 * 60 * 60 }, // cache up to 1 day
},
},
{
// Cache images and other resources
urlPattern: /^https?.*/i,
handler: 'NetworkFirst',
options: { cacheName: 'external-resources' },
},
],
});
const nextConfig = {
reactStrictMode: true,
trailingSlash: true,
images: {
unoptimized: true,
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
};
module.exports = withPWA(nextConfig);