import { withPayload } from '@payloadcms/next/withPayload' /** @type {import('next').NextConfig} */ const nextConfig = { // Reduce memory usage during build experimental: { // Use fewer workers for builds on low-memory systems workerThreads: false, cpus: 1, // Allow server actions from these origins (behind reverse proxy) serverActions: { allowedOrigins: [ 'pl.porwoll.tech', 'pl.c2sgmbh.de', 'cms.c2sgmbh.de', ], }, }, // Webpack configuration for TypeScript/ESM compatibility webpack: (webpackConfig) => { webpackConfig.resolve.extensionAlias = { '.cjs': ['.cts', '.cjs'], '.js': ['.ts', '.tsx', '.js', '.jsx'], '.mjs': ['.mts', '.mjs'], } return webpackConfig }, } export default withPayload(nextConfig, { devBundleServerPackages: false })