I have a nextjs app that has a root layout that contains a button that calls a server action. That s

I have a nextjs app that has a root layout that contains a button that calls a server action. That server action imports a library that is 930 KB (105.65KB zipped) in size.
The issue is that this import is causing my worker to exceed the 1MB limit. When checking on my deployment, the uncompressed size of the worker goes from 3.5MB to 10MB+ just from this import. I would expect it go up by about 1MB when uncompressed, not 7MB.

Since the server action is being imported from within the root layout, it seems to be increasing the size of every page in my app, basically multiplying the the import size of the server action by the number of pages that use the root layout. Is this expected behavior?
Was this page helpful?