-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.mjs
More file actions
112 lines (101 loc) · 2.77 KB
/
Copy pathnext.config.mjs
File metadata and controls
112 lines (101 loc) · 2.77 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
106
107
108
109
110
111
112
import withPlaiceholder from '@plaiceholder/next';
import withBundleAnalyzer from '@next/bundle-analyzer';
const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
openAnalyzer: true,
});
/** @type {import('next').NextConfig} */
const nextConfig = {
compiler: {
removeConsole: {
exclude: ['error', 'warn'],
},
},
// Development Configuration
turbopack: {
rules: {},
resolveAlias: {},
resolveExtensions: ['.mdx', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.json'],
},
// Performance Optimizations
experimental: {
optimizePackageImports: [
'@apollo/client',
'ai',
'@ai-sdk/cohere',
'axios',
'chart.js',
'react',
'chart.js',
'react-chartjs-2',
'date-fns',
'react-syntax-highlighter',
'daisyui',
'next-share',
'react-dom',
'react-markdown',
'jsdom',
'reading-time',
'rehype-raw',
'@umami/api-client',
'chartjs-adapter-date-fns',
],
},
productionBrowserSourceMaps: true,
compress: true,
poweredByHeader: false,
// Security Configuration
async headers() {
return [
{
source: '/(.*)',
headers: [
// Prevents clickjacking by blocking iframe embedding
{ key: 'X-Frame-Options', value: 'DENY' },
// Prevents MIME type sniffing
{ key: 'X-Content-Type-Options', value: 'nosniff' },
// Controls how much referrer information should be included with requests
{ key: 'Referrer-Policy', value: 'origin-when-cross-origin' },
// Legacy XSS protection for older browsers
{ key: 'X-XSS-Protection', value: '1; mode=block' },
// Controls browser caching with revalidation
{
key: 'Cache-Control',
value: 'public, s-maxage=60, stale-while-revalidate=120',
},
// Enables DNS prefetching for improved performance
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
// Security policy for protecting against various attacks
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
],
},
];
},
// Image Optimization
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
minimumCacheTTL: 31536000,
dangerouslyAllowSVG: true,
contentDispositionType: 'attachment',
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
// Server Configuration
serverExternalPackages: [],
// Routing Configuration
async redirects() {
return [];
},
};
export default withPlaiceholder(bundleAnalyzer(nextConfig));