payload icon indicating copy to clipboard operation
payload copied to clipboard

[3.0] not-found.js 3 MB in size

Open cbratschi opened this issue 1 year ago • 1 comments

Link to reproduction

No response

Describe the Bug

Created a new project:

npx create-payload-app@beta --use-npm

Loaded the admin panel and checked the network traffic. Saw that the not-found.js is 3 MB in size and therefore the largest downloaded file in dev mode. I guess Next.js bundles a lot of thing in this file. Please check why the not-found page is that large.

Sizes of other files:

  • main-app.js: 1.6 MB
  • layout.js: 2.6 MB
  • not-found.js: 3.0 MB

After building the file is still quite large on first load but much lower than in dev mode:

Route (app)                              Size     First Load JS
┌ ○ /_not-found                          904 B          89.5 kB
├ ƒ /admin/[[...segments]]               151 B           449 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            88.5 kB
  ├ chunks/7023-71529f8b8f19b14b.js      32 kB
  ├ chunks/fd9d1056-e7758cab2dfefddb.js  53.5 kB
  └ other shared chunks (total)          3 kB

Next.js always loads the not-found file in dev model. This large file could be responsible for higher startup times.

To Reproduce

See above.

Payload Version

3.0.0-beta.25

Adapters and Plugins

No response

cbratschi avatar May 07 '24 14:05 cbratschi