Skip to content

Payload Local API increase First Load JS size to client chunks #7261

Closed as not planned

Description

@lazidoca

Link to reproduction

No response

Payload Version

3.0 beta 67

Node Version

20 LTS

Next.js Version

15 rc 72

Describe the Bug

Using getPayloadHMR or getPayload in Server Component to use Payload Local API increase the First Load JS size for other routes to more than 450kB.

Reproduction Steps

Use https://github.com/payloadcms/payload-3.0-demo as the sample.
Update app/(app)/page.tsx:

import { Badge } from '@/components/Badge'
import { Background } from '@/components/Background'
import Link from 'next/link'
import React from 'react'
import { getPayloadHMR } from '@payloadcms/next/utilities'
import configPromise from '@payload-config'

const Page = async () => {
 const payload = await getPayloadHMR({ config: configPromise })
 const pages = await payload.find({
 collection: 'pages',
 })
...
the rest

Build the project

Build result:

Route (app)                              Size     First Load JS
┌ ○ /                                    313 B           462 kB
├ ○ /_not-found                          903 B          92.9 kB
├ ƒ /admin/[[...segments]]               439 B           541 kB
├ ƒ /api/[...slug]                       0 B                0 B
├ ƒ /api/graphql                         0 B                0 B
├ ƒ /api/graphql-playground              0 B                0 B
└ ƒ /my-route                            0 B                0 B
+ First Load JS shared by all            92 kB
  ├ chunks/1038-36cab95de5fa964d.js      37.2 kB
  ├ chunks/2853d6fe-c5264f1434dff8cb.js  51.7 kB
  └ other shared chunks (total)          3.1 kB


○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand

Adapters and Plugins

No response

Activity

  1. added
    status: needs-triage
    on Jul 21, 2024
  2. rilrom commented on Jul 21, 2024

    @rilrom
    Contributor

    Relates to #6441.

  3. removed
    status: needs-triage
    on Jul 21, 2024
  4. added a commit that references this issue on Aug 5, 2024
  5. AlessioGr commented on Aug 13, 2024

    @AlessioGr
    Member

    This has been fixed by #7620

  6. github-actions commented on Sep 6, 2024

    @github-actions
    Contributor

    This issue has been automatically locked.
    Please open a new issue if this issue persists with any additional detail.

  7. locked as resolved and limited conversation to collaborators on Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions