-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
49 lines (46 loc) · 1.03 KB
/
next.config.js
File metadata and controls
49 lines (46 loc) · 1.03 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
import createNextIntlPlugin from 'next-intl/plugin';
const withNextIntl = createNextIntlPlugin('./src/i18n/config.ts');
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
// 即使有 ESLint 错误,也允许生产构建成功
ignoreDuringBuilds: true,
},
// SEO 优化配置
async redirects() {
return [
// 重定向根路径到英文版本(有利于谷歌收录英文版)
{
source: '/',
destination: '/en',
permanent: true,
},
]
},
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
],
},
]
},
// 启用压缩
compress: true,
// 启用静态优化
trailingSlash: false,
};
export default withNextIntl(nextConfig);