-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
110 lines (104 loc) · 3 KB
/
next.config.js
File metadata and controls
110 lines (104 loc) · 3 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
import { withPayload } from '@payloadcms/next/withPayload'
import redirects from './redirects.js'
// Get the server URL for image configuration
const getServerURL = () => {
if (process.env.NEXT_PUBLIC_SERVER_URL) {
return process.env.NEXT_PUBLIC_SERVER_URL
}
if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
}
if (process.env.VERCEL_URL) {
return `https://${process.env.VERCEL_URL}`
}
return 'http://localhost:3000'
}
/** @type {import('next').NextConfig} */
const nextConfig = {
// Ensure builds fail on ESLint errors
eslint: {
ignoreDuringBuilds: false,
},
// Ensure builds fail on TypeScript errors
typescript: {
ignoreBuildErrors: false,
},
// Disable static generation for all pages to ensure fresh CMS data
experimental: {
ppr: false, // Disable Partial Prerendering
},
images: {
unoptimized: true,
remotePatterns: [
...[getServerURL() /* 'https://example.com' */].map((item) => {
const url = new URL(item)
return {
hostname: url.hostname,
protocol: url.protocol.replace(':', ''),
}
}),
],
},
webpack: (webpackConfig) => {
webpackConfig.resolve.extensionAlias = {
'.cjs': ['.cts', '.cjs'],
'.js': ['.ts', '.tsx', '.js', '.jsx'],
'.mjs': ['.mts', '.mjs'],
}
return webpackConfig
},
reactStrictMode: true,
redirects,
async headers() {
return [
{
source: '/:path*',
headers: [
{
key: 'X-Frame-Options',
value: 'DENY',
},
{
key: 'X-Content-Type-Options',
value: 'nosniff',
},
{
key: 'Referrer-Policy',
value: 'strict-origin-when-cross-origin',
},
{
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=()',
},
{
key: 'Content-Security-Policy',
value: `
default-src 'self';
script-src 'self' 'unsafe-eval' 'unsafe-inline' https://app.cal.com https://*.cal.com;
style-src 'self' 'unsafe-inline';
img-src 'self' data: https: blob:;
font-src 'self' data:;
connect-src 'self' https://app.cal.com https://*.cal.com https://*.vercel.app https://www.rpmdetail.co https://rpmdetail.co http://localhost:3000;
frame-src 'self' https://app.cal.com https://*.cal.com;
object-src 'none';
base-uri 'self';
form-action 'self';
upgrade-insecure-requests;
`.replace(/\s{2,}/g, ' ').trim(),
},
],
},
{
// Allow Cal.com embed to load in iframe
source: '/booking',
headers: [
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
],
},
]
},
}
export default withPayload(nextConfig, { devBundleServerPackages: false })