-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathnext.config.ts
More file actions
69 lines (62 loc) · 2.02 KB
/
next.config.ts
File metadata and controls
69 lines (62 loc) · 2.02 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
import createNextIntlPlugin from 'next-intl/plugin'
import type { NextConfig } from "next"
const withNextIntl = createNextIntlPlugin()
const nextConfig: NextConfig = {
output: 'standalone', // 打包成一个独立的文件
poweredByHeader: false, // 移除X-Powered-By头以提高安全性
// 启用页面的静态优化
staticPageGenerationTimeout: 180, // 增加静态生成超时时间(秒)
images: {
remotePatterns: [
new URL('https://static.claudemcp.com/**'),
new URL('https://picdn.youdianzhishi.com/**')
],
},
// 设置缓存控制
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400',
},
],
},
{
source: '/api/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=60, s-maxage=3600, stale-while-revalidate=3600',
},
],
},
{
source: '/_next/static/(.*)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
source: '/(.*).(jpg|jpeg|png|gif|ico|svg|webp)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
]
},
// 实验性功能最小配置
experimental: {
// 针对Next.js支持的实验性功能
optimizeCss: true, // 优化CSS
},
}
export default withNextIntl(nextConfig)