-
Notifications
You must be signed in to change notification settings - Fork 64
/
next.config.js
188 lines (179 loc) · 8.84 KB
/
next.config.js
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* eslint-disable @typescript-eslint/no-var-requires */
/**
* @type {import('next').NextConfig}
*/
//const withTM = require('next-transpile-modules'); // pass the modules you would like to see transpiled
const securityHeaders = [
{
key: 'Content-Security-Policy',
value:
"default-src 'self' data: blob: *.sitecore.com *.sitecore.net *.stylelabs.cloud *.googleapis.com *.gstatic.com *.azureedge.net *.sitecorecloud.io; frame-src * 'self' 'unsafe-inline'; frame-ancestors 'self' https://*.sitecore.com; script-src * blob: data: 'self' 'unsafe-inline' 'unsafe-eval'; script-src-elem * 'self' 'unsafe-inline'; script-src-attr * 'self' 'unsafe-inline'; style-src * 'self' 'unsafe-inline'; style-src-elem * 'self' 'unsafe-inline'; style-src-attr * 'self' 'unsafe-inline' data:; img-src * 'self' 'unsafe-inline' data:; font-src * data: 'self' 'unsafe-inline'; connect-src *; object-src 'none'; media-src * data: blob: 'unsafe-inline' 'unsafe-eval';",
},
{
key: 'Referrer-Policy',
value: 'same-origin',
},
{
key: 'Permissions-Policy',
value: 'accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-XSS-Protection',
value: '1; mode=block',
},
];
const redirects = [
{ source: '/learn/integrations/xm-cdp', destination: '/learn/integrations/xm-smarthub-cdp', permanent: true },
{ source: '/trial', destination: '/trials', permanent: true },
{ source: '/commerce/:path*', destination: '/products/:path*', permanent: true },
{ source: '/content-management', destination: '/products', permanent: true },
{ source: '/content-management/content-hub-one', destination: '/products/content-hub-one', permanent: true },
{ source: '/content-management/edge-xm', destination: '/products/experience-platform/edge', permanent: true },
{ source: '/content-management/experience-management', destination: '/products/experience-platform/xm', permanent: true },
{ source: '/content-management/headless', destination: '/products/experience-platform/headless', permanent: true },
{ source: '/content-management/search', destination: '/products/search', permanent: true },
{ source: '/content-management/sxa', destination: '/products/experience-platform/sxa', permanent: true },
{ source: '/content-management/xm-cloud', destination: '/products/xm-cloud', permanent: true },
{ source: '/customer-data-management', destination: '/products', permanent: true },
{ source: '/customer-data-management/cdp', destination: '/products/customer-data-platform', permanent: true },
{ source: '/customer-data-management/experience-platform', destination: '/products/experience-platform', permanent: true },
{ source: '/dam-and-content-operations', destination: '/products', permanent: true },
{ source: '/dam-and-content-operations/content-hub', destination: '/products/content-hub', permanent: true },
{ source: '/dam-and-content-operations/dam', destination: '/products/content-hub', permanent: true },
{ source: '/devops', destination: '/products/devops-and-tools ', permanent: true },
{ source: '/devops/arm-templates', destination: '/products/devops-and-tools/arm-templates', permanent: true },
{ source: '/devops/containers', destination: '/products/devops-and-tools/containers ', permanent: true },
{ source: '/devops/developer-collection', destination: '/products/devops-and-tools/developer-collection ', permanent: true },
{ source: '/devops/managed-cloud', destination: '/products/managed-cloud', permanent: true },
{ source: '/devops/sitecore-install-framework', destination: '/products/devops-and-tools/sif', permanent: true },
{ source: '/integrations/connect', destination: '/products/connect', permanent: true },
{ source: '/marketing-automation/experience-platform', destination: '/products/experience-platform', permanent: true },
{ source: '/marketing-automation/send', destination: '/products/send', permanent: true },
{ source: '/personalization-testing/experience-platform', destination: '/products/experience-platform', permanent: true },
{ source: '/personalization-testing/personalize', destination: '/products/personalize', permanent: true },
{ source: '/changelog/xm-cloud/14112024/component-a%2fb%2fn-testing-is-now-live-in-xm-cloud', destination: '/changelog/xm-cloud/14112024/component-a-b-n-testing-is-now-live-in-xm-cloud', permanent: true },
{ source: '/changelog/xm-cloud/13112024/component-a%2fb%2fn-testing-is-now-live-in-xm-cloud', destination: '/changelog/xm-cloud/14112024/component-a-b-n-testing-is-now-live-in-xm-cloud', permanent: true },
{ source: '/learn/accelerate/xm-cloud/pre-development/developer-experience', destination: '/learn/accelerate/xm-cloud/pre-development/developer-considerations', permanent: true },
{ source: '/learn/accelerate/xm-cloud/pre-development/developer-experience/branching-strategy', destination: '/learn/accelerate/xm-cloud/pre-development/developer-considerations/branching-strategy', permanent: true },
{ source: '/learn/accelerate/xm-cloud/pre-development/developer-experience/nextjs-azure-app-services', destination: '/learn/accelerate/xm-cloud/pre-development/hosting-applications/nextjs-azure-app-services', permanent: true },
{ source: '/learn/accelerate/xm-cloud/pre-development/developer-experience/hosting-web-application', destination: '/learn/accelerate/xm-cloud/pre-development/hosting-applications/nextjs-azure-app-services', permanent: true },
{ source: '/learn/accelerate/xm-cloud/pre-development/project-planning/xm-xp-to-xmc', destination: '/learn/accelerate/xm-cloud/pre-development/discovery/xm-xp-to-xmc', permanent: true },
{ source: '/learn/accelerate/xm-cloud/implementation/redirect', destination: '/learn/accelerate/xm-cloud/implementation/information-architecture/redirect', permanent: true },
{ source: '/learn/accelerate/xm-cloud/implementation/sitemap', destination: '/learn/accelerate/xm-cloud/implementation/information-architecture/sitemap', permanent: true },
{ source: '/learn/accelerate/xm-cloud/implementation/localization', destination: '/learn/accelerate/xm-cloud/implementation/information-architecture/localization', permanent: true },
{ source: '/learn/accelerate/xm-cloud/implementation/search', destination: '/learn/accelerate/xm-cloud/implementation/sitecore-search', permanent: true },
];
const nextConfig = {
experimental: {
largePageDataBytes: 256 * 100000,
},
// Set locales so we have appropriate lang attributes without a custom _document
// ia8n commentted out due to temporary issue with ISR, see https://github.com/Sitecore/developer-portal/issues/182
// i18n: {
// locales: ['en'],
// defaultLocale: 'en',
// },
// Needed to expose in clientside.
env: {
GTM_ID: process.env.NEXT_PUBLIC_GTM_ID,
GTM_AUTH: process.env.NEXT_PUBLIC_GTM_AUTH,
GTM_ENVIRONMENT: process.env.NEXT_PUBLIC_GTM_ENVIRONMENT,
},
images: {
dangerouslyAllowSVG: true,
remotePatterns: [
{
protocol: 'https',
hostname: 'sitecorecdn.azureedge.net',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'i.ytimg.com',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'sitecorecdn.azureedge.net',
pathname: '/**',
},
{
protocol: 'https',
hostname: '**.sitecorecontenthub.cloud',
pathname: '/**',
},
{
protocol: 'https',
hostname: '**.stylelabs.cloud',
pathname: '/**',
},
{
protocol: 'https',
hostname: '**.sitecore.com',
pathname: '/**',
},
{
protocol: 'https',
hostname: '**.sitecorecloud.io',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'wwwsitecorecom.azureedge.net',
pathname: '/**',
},
{
protocol: 'https',
hostname: '**.gitbook.com',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'theme.zdassets.com',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'opengraph.githubassets.com',
pathname: '/**',
},
],
deviceSizes: [640, 750, 828, 1080, 1200, 1920],
minimumCacheTTL: 60,
},
async headers() {
return [
{
source: '/(.*)',
headers: securityHeaders,
},
];
},
async redirects() {
return [...redirects];
},
async rewrites() {
return [
{
source: '/Downloads/:slug*',
destination: '/downloads/:slug*',
},
{
source: '/learn/accelerate/xm-cloud/updates',
destination: '/feeds/rss-accelerate-xmcloud.xml',
},
];
},
};
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
module.exports = withBundleAnalyzer(nextConfig);