forked from StellarFlow-Network/stellarflow-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
56 lines (52 loc) · 1.46 KB
/
Copy pathnext.config.ts
File metadata and controls
56 lines (52 loc) · 1.46 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
import type { NextConfig } from "next";
// 1. Initialize the Bundle Analyzer plugin
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});
// 2. Initialize the PWA plugin with its production-ready caching rules
const withPWA = require("next-pwa")({
dest: "public",
register: true,
skipWaiting: true,
disable: process.env.NODE_ENV === "development",
runtimeCaching: [
{
urlPattern: /\/(relayers|logs|contracts)(\/.*)?$/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "page-shells",
expiration: {
maxEntries: 50,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
{
urlPattern: /^https?.*/,
handler: "NetworkFirst",
options: {
cacheName: "offlineCache",
expiration: {
maxEntries: 200,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
networkTimeoutSeconds: 10,
},
},
],
});
// 3. Your optimized Next.js base configurations
const nextConfig: NextConfig = {
reactCompiler: false,
turbopack: {},
images: {
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
imageSizes: [16, 32, 48, 64, 96, 128, 256],
},
experimental: {
optimizePackageImports: ['lucide-react'],
},
};
// 4. Chain both plugins together sequentially to export the final configuration
export default withPWA(withBundleAnalyzer(nextConfig));