-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
157 lines (142 loc) · 3.94 KB
/
next.config.ts
File metadata and controls
157 lines (142 loc) · 3.94 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import type { NextConfig } from "next";
/**
* Next.js Configuration
* Optimized for production deployment
*/
const nextConfig: NextConfig = {
/* ============================================
* PRODUCTION OPTIMIZATIONS
* ============================================ */
// Enable React strict mode for better development experience
reactStrictMode: true,
// Compress output files
compress: true,
// Generate standalone output for optimized Docker deployments
// output: 'standalone',
/* ============================================
* IMAGE OPTIMIZATION
* ============================================ */
images: {
// Allowed image domains (add your backend domain here)
remotePatterns: [
{
protocol: 'http',
hostname: 'localhost',
port: '5000',
pathname: '/uploads/**',
},
{
protocol: 'https',
hostname: '**.vercel.app',
pathname: '/uploads/**',
},
// Supabase Storage for QR Codes
{
protocol: 'https',
hostname: '**.supabase.co',
pathname: '/storage/v1/object/public/**',
},
// Production backend domain
{
protocol: 'https',
hostname: 'be-pencatatan-posyandu.vercel.app',
pathname: '/uploads/**',
},
],
// Image formats to support
formats: ['image/avif', 'image/webp'],
// Disable image optimization in development for faster builds
unoptimized: process.env.NODE_ENV === 'development',
},
/* ============================================
* SECURITY HEADERS
* ============================================ */
async headers() {
return [
{
// Apply security headers to all routes
source: '/:path*',
headers: [
{
key: 'X-DNS-Prefetch-Control',
value: 'on',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
{
key: 'Referrer-Policy',
value: 'origin-when-cross-origin',
},
{
key: 'Permissions-Policy',
value: 'camera=(self), microphone=(), geolocation=()',
},
],
},
];
},
/* ============================================
* TYPESCRIPT CONFIGURATION
* ============================================ */
typescript: {
// Fail build on TypeScript errors in production
ignoreBuildErrors: false,
},
/* ============================================
* EXPERIMENTAL FEATURES
* ============================================ */
experimental: {
// Enable optimized package imports
optimizePackageImports: ['lucide-react', 'recharts'],
},
/* ============================================
* TURBOPACK CONFIGURATION (Next.js 16+)
* ============================================ */
turbopack: {
// Rules for module resolution
resolveAlias: {
// Add custom aliases if needed
// '@': './src',
},
// Resolve extensions
resolveExtensions: [
'.tsx',
'.ts',
'.jsx',
'.js',
'.mjs',
'.json',
],
// Module rules for loaders
rules: {
// Custom rules can be added here
// Example: handle specific file types
},
},
/* ============================================
* WEBPACK CONFIGURATION (Fallback)
* ============================================ */
webpack: (config) => {
// Custom webpack configuration if needed
// Ignore source map warnings from third-party packages
config.ignoreWarnings = [
{ module: /node_modules/ },
];
return config;
},
};
export default nextConfig;