How To Reduce Bundle Size For Edge?
Unanswered
Spectacled bear posted this in #help-forum
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?
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?
6 Replies
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.
@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.
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
It could be cumurative size. as i said, off-loading some of routes to Node.js could help.
Spectacled bearOP
It's not because I deleted a route and size didn't change at all.