-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathnext.config.js
More file actions
98 lines (90 loc) · 2.3 KB
/
next.config.js
File metadata and controls
98 lines (90 loc) · 2.3 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
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
poweredByHeader: false, // Remove X-Powered-By header for security
compress: true, // Enable gzip compression
// Performance optimizations
experimental: {
optimizeCss: true,
scrollRestoration: true,
largePageDataBytes: 128 * 100000, // 12.8MB for large file support
},
// Allow cross-origin requests for network access
allowedDevOrigins: ['192.168.1.33', '192.168.56.1'],
// Image optimization
images: {
domains: ['localhost'],
formats: ['image/webp', 'image/avif'],
minimumCacheTTL: 86400, // 24 hours cache
dangerouslyAllowSVG: true,
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
},
// Headers for better performance and security
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Content-Type-Options',
value: 'nosniff'
},
{
key: 'X-Frame-Options',
value: 'DENY'
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin'
}
]
},
{
source: '/api/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'no-store, max-age=0'
}
]
},
{
source: '/_next/static/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable'
}
]
}
];
},
// Environment variables
env: {
MONGODB_URI: process.env.MONGODB_URI,
GEMINI_API_KEY: process.env.GEMINI_API_KEY,
},
// Webpack optimizations
webpack: (config, { isServer, dev }) => {
// Optimize bundle size in production
if (!dev && !isServer) {
config.optimization = {
...config.optimization,
splitChunks: {
...config.optimization.splitChunks,
cacheGroups: {
...config.optimization.splitChunks.cacheGroups,
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
};
}
return config;
},
}
module.exports = nextConfig