Next on Pages with Next 14 suddenly produces huge build package.

Just upgraded to Next14 on a project, and now npx @cloudflare/next-on-pages produces a huge 45MB output and I get the Error: Failed to publish your Function. Got error: Your Functions script is over the 1 MiB size limit (workers.api.error.script_too_large) Is this a known issue when switching to Next14, I'm aware it only came out a little bit ago. Or is this something more to do with my project? Also while debugging and building using npx @Not Cloudflare :)/next-on-pages I keep getting asked to log into vercel, but that only happened after a few tries, what's up with that?
3 Replies
James
James12mo ago
No that is not normal if your app wasn't producing those bundle sizes on nextjs 13 and the only change you have made was upgrading the next dependency. In any case, it will be something related to one of your dependencies, font files if you have them, wasm if you have that, and so on... Or it could be related to the large amount of routes. But 45mb is a seriously large size... The Vercel CLI would only ask you to login if you run next-on-pages in skip-build mode and have no .vercel/project.json file that we would normally generate
Canopy
CanopyOP12mo ago
Ah thanks, that was seriously annoying me while debugging, think I must have run vercel build while I was messing around with that. Back to debugging which dependency is causing this mess. Turns out I was being a bad scientist and changing multiple things at once, looks like the culprit was using the import ImageResponse from next/og causing the massive file size and I forgot I wrote that somewhere in my work.
James
James12mo ago
akoalathumbsup
Want results from more Discord servers?
Add your server