feat: migrate Payload CMS to MDX and harden static infrastructure

This commit is contained in:
2026-05-04 14:48:04 +02:00
parent d51e220802
commit d3141187ee
165 changed files with 7654 additions and 16136 deletions

View File

@@ -2,7 +2,6 @@ import withMintelConfig from '@mintel/next-config';
import withBundleAnalyzer from '@next/bundle-analyzer';
import { withSentryConfig } from '@sentry/nextjs';
import { withPayload } from '@payloadcms/next/withPayload';
const isProd = process.env.NODE_ENV === 'production';
/** @type {import('next').NextConfig} */
@@ -32,7 +31,6 @@ const nextConfig = {
},
...(isProd ? { output: 'standalone' } : {}),
async headers() {
const isProd = process.env.NODE_ENV === 'production';
const umamiDomain = new URL(process.env.UMAMI_API_ENDPOINT || 'https://analytics.infra.mintel.me').origin;
const glitchtipDomain = new URL(process.env.SENTRY_DSN ? new URL(process.env.SENTRY_DSN).origin : 'https://errors.infra.mintel.me').origin;
const extraImgDomains = [
@@ -46,6 +44,9 @@ const nextConfig = {
'https://tile.openstreetmap.org',
'https://unpkg.com',
].join(' ');
const isLocalhost = process.env.NODE_HOSTNAME === 'localhost' ||
process.env.NEXT_PUBLIC_SITE_URL?.includes('localhost') ||
!process.env.NEXT_PUBLIC_SITE_URL;
const cspHeader = `
default-src 'self';
@@ -59,7 +60,7 @@ const nextConfig = {
base-uri 'self';
form-action 'self';
frame-ancestors 'none';
${isProd ? 'upgrade-insecure-requests;' : ''}
${isProd && !isLocalhost ? 'upgrade-insecure-requests;' : ''}
`.replace(/\s{2,}/g, ' ').trim();
const secureHeaders = [
@@ -83,10 +84,12 @@ const nextConfig = {
key: 'Permissions-Policy',
value: 'camera=(), microphone=(), geolocation=(), interest-cohort=()',
},
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
...(!isLocalhost ? [
{
key: 'Strict-Transport-Security',
value: 'max-age=63072000; includeSubDomains; preload',
},
] : []),
];
return [
@@ -478,7 +481,7 @@ const withAnalyzer = withBundleAnalyzer({
// withMintelConfig internally sets output:'standalone' and wraps with withSentryConfig.
// In dev mode, standalone triggers @vercel/nft file tracing on every compile through
// VirtioFS, which hammers CPU. Strip it for dev.
let resolvedConfig = withPayload(withAnalyzer(withMintelConfig(nextConfig)));
let resolvedConfig = withAnalyzer(withMintelConfig(nextConfig));
if (!isProd) {
delete resolvedConfig.output;