Script size limit 1MB, really?

I have a react site with server rendering, meaning I need to bundle all the pages into the scripts and currently ends up being 4 MB (not a big site yet tbh). I am getting workers.api.error.script_too_large when trying to upload it to worker sites.
Is this something you can change? [email protected] has a 50 MB size limit which is more reasonable. I can’t see how people can get by with server rendering in up to 1 MB?

On a “similar” project, I have a workers script component that is 80Kb, that incrementally loads more data from Workers KV into script Global Variables, you could build something around this as well.

3 Likes

Thanks, that could be a workaround. But how is performance?

The smaller the scripts and the more KV that is cached as globals, the better the performance.

If it’s cached, the Worker will load on average ~50ms, while a lambda at that size will still load at ~200-300 ms (Without cold-start)

1 Like

Could you share some code on how you did this?

@adaptive Will be nice if you can share your solution (or part of). :wink: