payloadcms / vercel-deploy-payload-postgres

One-click deployment template of Payload 3.0 on Vercel
https://payloadcms.com
58 stars 9 forks source link

Frontend is loading all admin chunks #5

Open digitaledge-git opened 1 month ago

digitaledge-git commented 1 month ago

I just applied the bundle analyzer to a production build of my site and noticed that all payload chunks are being loaded in the frontend of the Next.js website. Is this intended? This adds almost 3MB of data that should only be loaded in the admin panel though.

bundle_analyze

digitaledge-git commented 1 month ago

I just figured out that all those chunks are imported with the configPromise used in a server component:

import configPromise from '@payload-config'
import { getPayloadHMR } from '@payloadcms/next/utilities'

const payload = getPayloadHMR({ config: await configPromise })