Next.js Discord

Discord Forum

The bundle size limitation

Unanswered
jobless posted this in #help-forum
Open in Discord
I got
2026-06-12T06:50:18.411289Z │ Total (82 modules) │ │ 136657.83 KiB │ 2026-06-12T06:50:18.51029Z ▲ [WARNING] The package "node:buffer" wasn't found on the file system but is built into node. 2026-06-12T06:50:18.510589Z 2026-06-12T06:50:18.510717Z Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag. Refer to https://developers.cloudflare.com/workers/runtime-apis/nodejs/ for more details. Imported from: 2026-06-12T06:50:18.512452Z ✨ Compiled Worker successfully 2026-06-12T06:50:19.360239Z Generated Pages Functions bundle size (140032550) is over the limit of 25.0 MiB 2026-06-12T06:50:20.121Z Failed: generating Pages Functions failed. Check the logs above for more information. If this continues for an unknown reason, contact support: https://cfl.re/3WgEyrH

Any suggestion on how to reduce the bundle size, This is the lib that taken mostly of my space Three.js, Motion, Mui, I have asking claude, It said I shall remove those lib,
I have try remove the edge runtime.

1 Reply

New Guinea Freshwater Crocodile
Hey! Looking at your logs, a 140 MB Pages Functions bundle is unusually large for Three.js, MUI, and Motion alone.

Before removing libraries, I'd check what's actually being bundled. My first suspicion would be a large asset, dataset, 3D model, or a server-side dependency being pulled into the worker.

Are you importing any .glb, .gltf, large JSON files, or SDKs directly into your code?

If you can share your package.json or a bundle analyzer report, it'll be much easier to identify what's contributing most to the bundle size.