-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
244 lines (241 loc) · 7.37 KB
/
Copy pathnext.config.js
File metadata and controls
244 lines (241 loc) · 7.37 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
const createNextIntlPlugin = require('next-intl/plugin');
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts');
/** @type {import('next').NextConfig} */
const nextConfig = {
// Move the dev-only build/error indicator out of the bottom-left default, where
// it sits on top of the mobile bottom nav. (Dev only — never shipped to prod.)
devIndicators: {
position: 'top-left',
},
// next-auth v5 beta ships as ESM with an internal circular dependency that leaves
// React = null inside webpack's static-generation workers. Forcing transpilation
// makes webpack process it as CJS in the same pass as the app, which resolves the
// initialization order and prevents the React-null crash during build.
transpilePackages: ['next-auth', '@auth/core'],
images: {
unoptimized: false,
remotePatterns: [
{
protocol: 'https',
hostname: '*.amazonaws.com',
pathname: '/**',
},
// Cloudflare R2 — where all content images actually live (S3_PUBLIC_URL,
// bucket revampit-media). Without this the optimizer rejects R2 URLs,
// which is why `unoptimized` was scattered across image components.
{
protocol: 'https',
hostname: '*.r2.dev',
pathname: '/**',
},
],
},
async rewrites() {
// Deck URLs (`/presentations/<slug>`) are intentionally NOT rewritten to the
// static index.html here: an `afterFiles` rewrite is matched BEFORE dynamic
// app routes, which would bypass the access gate. Instead the route handler
// `src/app/presentations/[slug]/route.ts` owns the URL — it enforces each
// deck's `audience` and serves the file from public/ (same fs pattern the
// blog uses for content/posts). Nested assets + /_assets stay static.
return [];
},
async headers() {
return [
{
// Prevent search engines from indexing presentations (unlisted, share-by-link only)
source: '/presentations/:path*',
headers: [{ key: 'X-Robots-Tag', value: 'noindex, nofollow' }],
},
];
},
async redirects() {
return [
// Redirect old Hirn paths to new Analyse paths
{
source: '/admin/hirn/finanzen',
destination: '/admin/analyse/finanzen',
permanent: true,
},
{
source: '/admin/hirn/kennzahlen',
destination: '/admin/analyse/kennzahlen',
permanent: true,
},
{
source: '/admin/hirn/wirkung',
destination: '/admin/analyse/wirkung',
permanent: true,
},
{
source: '/admin/hirn/transparenz',
destination: '/admin/analyse/transparenz',
permanent: true,
},
// Redirect old AI page to main Hirn page
{
source: '/admin/hirn/ai',
destination: '/admin/hirn',
permanent: true,
},
// Decisions — member-friendly URL aliases
{
source: '/decisions',
destination: '/admin/decisions',
permanent: false,
},
{
source: '/decisions/:id',
destination: '/admin/decisions/:id',
permanent: false,
},
// Techniker — canonical paths live under IT-Hilfe hub
{
source: '/repairers',
destination: '/it-hilfe/techniker',
permanent: true,
},
{
source: '/repairers/:id',
destination: '/it-hilfe/techniker/:id',
permanent: true,
},
{
source: '/techniker',
destination: '/it-hilfe/techniker',
permanent: true,
},
{
source: '/techniker/:id',
destination: '/it-hilfe/techniker/:id',
permanent: true,
},
{
source: '/it-hilfe/helfer',
destination: '/it-hilfe/techniker',
permanent: true,
},
{
source: '/it-hilfe/helfer/:id',
destination: '/it-hilfe/techniker/:id',
permanent: true,
},
{
source: '/profil/skills',
destination: '/profil/techniker',
permanent: true,
},
// Shop - the online shop is the marketplace. Keep old URLs as
// /support consolidated into the canonical donate page (its unique
// channels — Ko-fi, GitHub Sponsors, contribute — now live there).
{
source: '/support',
destination: '/get-involved/donate',
permanent: true,
},
{
source: '/:locale(en|fr|it|es|ja|ko|ru)/support',
destination: '/:locale/get-involved/donate',
permanent: true,
},
// hard redirects so crawlers and users do not render a parallel
// shop shell before landing on products.
{
source: '/shop',
destination: '/marketplace',
permanent: true,
},
{
source: '/:locale(en|fr|it|es|ja|ko|ru)/shop',
destination: '/:locale/marketplace',
permanent: true,
},
{
source: '/shop/search',
destination: '/marketplace',
permanent: true,
},
{
source: '/:locale(en|fr|it|es|ja|ko|ru)/shop/search',
destination: '/:locale/marketplace',
permanent: true,
},
{
source: '/shop/category/business-laptops',
destination: '/marketplace?category=10',
permanent: true,
},
{
source: '/:locale(en|fr|it|es|ja|ko|ru)/shop/category/business-laptops',
destination: '/:locale/marketplace?category=10',
permanent: true,
},
{
source: '/shop/category/:slug',
destination: '/marketplace',
permanent: true,
},
{
source: '/:locale(en|fr|it|es|ja|ko|ru)/shop/category/:slug',
destination: '/:locale/marketplace',
permanent: true,
},
{
source: '/shop/product/:uuid',
destination: '/marketplace',
permanent: true,
},
{
source: '/:locale(en|fr|it|es|ja|ko|ru)/shop/product/:uuid',
destination: '/:locale/marketplace',
permanent: true,
},
];
},
webpack: (config, { isServer, dev }) => {
// Handle fs module for client-side
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
};
}
// Reduce file watching load in dev to avoid EMFILE errors
if (dev) {
config.watchOptions = {
...(config.watchOptions || {}),
ignored: [
'**/.git/**',
'**/.next/**',
'**/node_modules/**',
'**/.swc/**',
'**/logs/**',
'**/playwright-report/**',
'**/test-results/**',
'**/postgres-init/**',
'**/cms-api/**',
'**/examples/**',
'**/packages/**',
],
followSymlinks: false,
};
}
return config;
},
// Enable static optimization
output: 'standalone',
// Ensure proper CSS handling
experimental: {
optimizeCss: process.env.NODE_ENV === 'production',
// The proxy (src/proxy.ts) makes Next buffer every request body, capped
// at 10 MB by default — larger bodies are silently TRUNCATED ("Unexpected
// end of form"), which broke every meeting-audio upload above 10 MB.
// Raise the cap above FILE_SIZE_LIMITS.AUDIO_MAX (250 MB) so protocol
// recordings reach /api/protocols/[id]/process-sources intact.
proxyClientMaxBodySize: '260mb',
},
// Add specific CSS handling
sassOptions: {
includePaths: ['./src/styles'],
},
};
module.exports = withNextIntl(nextConfig);