This PR skips bundling server-only payload packages during development, which results in 50% faster compilation speeds using turbo. Test results using our blank template (both /api and /admin): Webpack before: 11.5 Webpack now: 7.1s => 38% faster compilation speed Turbopack before: 4.1s Turbopack after: 2.1s => 50% faster compilation speed
28 lines
771 B
JavaScript
28 lines
771 B
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,
|
|
}
|
|
|
|
export default withPayload(nextConfig, { devBundleServerPackages: false })
|