-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
135 lines (121 loc) · 3.63 KB
/
next.config.ts
File metadata and controls
135 lines (121 loc) · 3.63 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
// ═══════════════════════════════════════════════════════════
// PATCHPATH AI - OPTIMIZED NEXT.JS CONFIGURATION
// ═══════════════════════════════════════════════════════════
// React 19 Compiler (Stable in Oct 2025 - v1.0 released)
// Eliminates need for manual memo/useMemo/useCallback
// Performance: 12% faster initial loads, 2.5x faster interactions
experimental: {
reactCompiler: true, // Auto-memoization, granular optimization
serverActions: {
// Allow GitHub Codespaces and local origins for Server Actions (all ports)
allowedOrigins: [
'localhost:3000',
'localhost:3001',
'localhost:3002',
'vigilant-space-couscous-9746pj7v4rrwh7944-3000.app.github.dev',
'vigilant-space-couscous-9746pj7v4rrwh7944-3001.app.github.dev',
'vigilant-space-couscous-9746pj7v4rrwh7944-3002.app.github.dev',
],
},
},
// Skip static optimization for error pages (Clerk + Next.js 15 compatibility)
skipTrailingSlashRedirect: true,
generateBuildId: async () => {
return `patchpath-build-${Date.now()}`;
},
// Turbopack Configuration (replaces experimental.turbo in Next.js 15+)
turbopack: {
rules: {
// Optimize Turbopack for our stack
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
// Performance Optimizations
reactStrictMode: true,
poweredByHeader: false,
compress: true,
// Docker/Container Deployment
output: 'standalone', // Required for Docker deployments
// Image Optimization (for rack images and future diagrams)
images: {
formats: ['image/avif', 'image/webp'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
remotePatterns: [
{
protocol: 'https',
hostname: 'modulargrid.net',
pathname: '/**',
},
// NEW: CDN image support (vision-first architecture)
{
protocol: 'https',
hostname: 'cdn.modulargrid.net',
pathname: '/img/racks/**',
},
],
},
// Build Optimization (swcMinify is now default in Next.js 15+, no need to specify)
compiler: {
removeConsole:
process.env.NODE_ENV === 'production'
? {
exclude: ['error', 'warn'],
}
: false,
},
// Headers for Security & Performance
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
],
},
];
},
// Webpack Bundle Analyzer (development only)
webpack: (config, { dev, isServer }) => {
// Optimize bundle size
if (!dev && !isServer) {
config.optimization = {
...config.optimization,
usedExports: true,
sideEffects: false,
};
}
// Add source maps in development
if (dev) {
config.devtool = 'eval-source-map';
}
return config;
},
// Logging
logging: {
fetches: {
fullUrl: true,
},
},
};
export default nextConfig;