-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
121 lines (113 loc) · 3.42 KB
/
next.config.js
File metadata and controls
121 lines (113 loc) · 3.42 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/** @type {import('next').NextConfig} */
const url = new URL(process.env.NEXT_PUBLIC_DOTCMS_HOST);
const nextConfig = {
reactStrictMode: true,
// Avoid broken ./vendor-chunks/* for packages Next splits oddly on the server
// (consola via @dotcms/client; highlight.js via react-syntax-highlighter; AWS SDK).
serverExternalPackages: [
"consola",
"@aws-sdk/client-s3",
"highlight.js",
"react-syntax-highlighter",
],
// Fixes confusing dev/build behavior when Next infers the wrong repo root due to multiple lockfiles.
// Also helps make stack traces and tracing output more consistent.
outputFileTracingRoot: __dirname,
async redirects() {
return [
{
source: '/security/:path',
destination: '/docs/known-security-issues?issueNumber=:path',
permanent: true,
},
{
source: '/docs/latest/:path',
destination: '/docs/:path',
permanent: true,
},
{
source: '/blogs',
destination: '/blog',
permanent: true,
},
]
},
images: {
remotePatterns: [
{
protocol: url.protocol.replace(":", ""),
hostname: url.hostname,
port: url.port || "",
},
{
protocol: 'https',
hostname: '*.public.blob.vercel-storage.com', // temporary solution to allow images to be served from vercel
},
{
protocol: 'https',
hostname: 'dev.dotcms.com',
pathname: '/dA/**',
},
{
protocol: 'https',
hostname: 'www.dotcms.com',
pathname: '**',
},
{
protocol: 'https',
hostname: 'images.unsplash.com',
},
],
dangerouslyAllowSVG: true,
loader: 'custom',
loaderFile: './util/imageLoader.ts',
},
async rewrites() {
return {
beforeFiles: [
{
source: "/dA/:path*",
destination: `${url.origin}/dA/:path*`,
},
{
source: "/contentAsset/image/:path*",
destination: `${url.origin}/contentAsset/image/:path*`,
},
{
source: '/sitemap.xml',
destination: '/api/sitemap'
}
],
afterFiles: [
]
};
},
async headers() {
return [
{
// Apply to static assets (images, fonts, etc.)
source: '/static/:path*',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
{
// Apply to API routes (no browser caching)
source: '/api/:path*',
headers: [
{
key: 'Cache-Control',
value: 'no-store, max-age=0',
},
],
},
];
},
experimental: {
largePageDataBytes: 128 * 100000,
}
};
module.exports = nextConfig;