-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathnext.config.ts
More file actions
42 lines (37 loc) · 1.21 KB
/
next.config.ts
File metadata and controls
42 lines (37 loc) · 1.21 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
import type { NextConfig } from 'next';
import path from 'path';
const nextConfig: NextConfig = {
// Enable standalone output for Docker deployment only when requested
// This allows 'next start' to work locally while still supporting optimized Docker images
output: process.env.NEXT_OUTPUT === 'standalone' ? 'standalone' : undefined,
// Ensure Next.js uses the correct root for tracing dependencies
outputFileTracingRoot: path.join(process.cwd()),
// Enable Turbopack (Next.js 16 default)
turbopack: {},
// Cache-Control headers for static assets in public/
async headers() {
return [
{
// Images, fonts, and icons - immutable long-term caching
source: '/:path*.(svg|ico|png|jpg|jpeg|gif|webp|woff|woff2|ttf|eot)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
// OpenAPI spec - shorter cache with stale-while-revalidate
source: '/openapi.json',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=3600, stale-while-revalidate=86400',
},
],
},
];
},
};
export default nextConfig;