-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.ts
44 lines (40 loc) · 1.14 KB
/
config.ts
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
import { NextConfig } from 'next';
export const withZebra = (nextConfig: NextConfig): NextConfig => {
return {
...nextConfig,
rewrites: async () => {
const baseUrl = process.env.NEOS_BASE_URL ?? '';
const neosRewrites = [
{
source: '/neosyoastseo/data/:path*',
destination: baseUrl + '/neosyoastseo/data/:path*',
},
{
source: '/neosyoastseo/page/renderPreviewPage',
destination: '/neos/preview',
},
{
source: '/neos/:path*',
destination: baseUrl + '/neos/:path*',
},
{
source: '/media/thumbnail/:path*',
destination: baseUrl + '/media/thumbnail/:path*',
},
{
source: '/_Resources/:path*',
destination: baseUrl + '/_Resources/:path*',
},
];
const rewrites = await nextConfig.rewrites?.();
if (!rewrites) {
return neosRewrites;
}
if (Array.isArray(rewrites)) {
return rewrites.concat(neosRewrites);
}
rewrites.afterFiles = rewrites.afterFiles.concat(neosRewrites);
return rewrites;
},
};
};