42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import { withPayload } from '@payloadcms/next/withPayload'
|
|
|
|
import redirects from './redirects.js'
|
|
|
|
const NEXT_PUBLIC_SERVER_URL = process.env.VERCEL_PROJECT_PRODUCTION_URL
|
|
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
|
: undefined || process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000'
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
images: {
|
|
remotePatterns: [
|
|
...[NEXT_PUBLIC_SERVER_URL /* 'https://example.com' */].map((item) => {
|
|
const url = new URL(item)
|
|
|
|
return {
|
|
hostname: url.hostname,
|
|
protocol: url.protocol.replace(':', ''),
|
|
}
|
|
}),
|
|
],
|
|
},
|
|
reactStrictMode: true,
|
|
redirects,
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: '/((?!admin|api)):path*',
|
|
destination: '/:tenantDomain/:path*',
|
|
has: [
|
|
{
|
|
type: 'host',
|
|
value: '(?<tenantDomain>.*)',
|
|
},
|
|
],
|
|
},
|
|
]
|
|
},
|
|
}
|
|
|
|
export default withPayload(nextConfig, { devBundleServerPackages: false })
|