-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
66 lines (61 loc) · 1.51 KB
/
Copy pathnext.config.ts
File metadata and controls
66 lines (61 loc) · 1.51 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
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
/* Performance optimizations */
// 启用Gzip压缩
compress: true,
// 移除 X-Powered-By: Next.js 响应头
poweredByHeader: false,
// Enable experimental features for better performance
experimental: {
optimizeCss: true,
optimizePackageImports: [
"lucide-react",
"@radix-ui/react-avatar",
"@radix-ui/react-dialog",
],
},
// Image optimization
images: {
formats: ["image/webp", "image/avif"],
minimumCacheTTL: 60 * 60 * 24 * 30, // 30 days
},
async headers() {
return [
{
source: "/api/(.*)",
headers: [
{
key: "Access-Control-Allow-Origin",
value: "*",
},
{
key: "Access-Control-Allow-Methods",
value: "GET, POST, PUT, DELETE, OPTIONS",
},
{
key: "Access-Control-Allow-Headers",
value: "Content-Type, Authorization",
},
// {
// key: "Content-Range",
// value: "bytes : 0-9/*",
// },
{
key: "Cache-Control",
value: "public, max-age=300, s-maxage=300",
},
],
},
{
source: "/(.*)\\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
];
},
};
export default nextConfig;