-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathnext.config.mjs
58 lines (54 loc) · 1.38 KB
/
next.config.mjs
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
/** @type {import('next').NextConfig} */
import withAntdLess from 'next-plugin-antd-less';
import createNextIntlPlugin from 'next-intl/plugin';
const CORS_HEADERS = [
{
key: "Access-Control-Allow-Credentials",
value: "true"
},
{
key: "Access-Control-Allow-Origin",
value: "*"
},
{
key: "Access-Control-Allow-Methods",
value: "GET,DELETE,PATCH,POST,PUT"
},
{
key: "Access-Control-Allow-Headers",
value: "Content-Type, Authorization",
},
];
const nextConfig = {
env: {
"JWT_SECRET": "next-admin",
"BASE_API_URL": "/api"
},
async headers() {
// 跨域配置
return [
{
source: "/favicon.ico",
headers: [
{
key: "Cache-Control",
value: "public, max-age=86400",
},
],
},
{
source: "/api/:path*", // 为访问 /api/** 的请求添加 CORS HTTP Headers
headers: CORS_HEADERS
},
{
source: "/specific", // 为特定路径的请求添加 CORS HTTP Headers,
headers: CORS_HEADERS
}
];
},
swcMinify: true,
// fastRefresh: true,
// concurrentFeatures: true
};
const withNextIntl = createNextIntlPlugin()(nextConfig);
export default withAntdLess(withNextIntl);