Next.js Discord

Discord Forum

How To Reduce Bundle Size For Edge?

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Avatar
Spectacled bearOP
Error: The Edge Function "index" size is 1.08 MB and your plan size limit is 1 MB.

What function is "index"? Does that mean my route "/" is too big? But none of my route is even close to 1mb. Does it just add every route together?
Image
Image

6 Replies

Avatar
tafutada777
yeah, the official doc says it is a total size of imported files such as fonts.
The maximum size for an Edge Function includes your JavaScript code, imported libraries and files (such as fonts), and all files bundled in the function.

If you reach the limit, make sure the code you are importing in your function is used and is not too heavy. You can use a package size checker tool like bundle to check the size of a package and search for a smaller alternative.
or off-load to Node.js runtime.
Avatar
Spectacled bearOP
I already read that. That doesn't help me solve the problem. I don't know which route is over 1MB. The build log says I'm not even close to 1MB limit
Avatar
tafutada777
It could be cumurative size. as i said, off-loading some of routes to Node.js could help.
Avatar
Spectacled bearOP
It's not because I deleted a route and size didn't change at all.