Next.js build fails when static file size is over 50MB #254
Replies: 2 comments 6 replies
-
If you use How does the V12 reproduction look without |
Beta Was this translation helpful? Give feedback.
-
Hey there, Our team believe that this is due to how we trace dependencies of a function when we build the app in our runtime: accessing the entire "/posts" folder while building this route, so our runtime included all the "/posts" folder as its dependency, which is pretty large: The reason is, we don't know which file it will access in advance, so everything is included: Our suggestion would be to move this step to a webpack plugin, or make it a pre-build script: We'll continue to explore how we can better document and mitigate this! |
Beta Was this translation helpful? Give feedback.
-
I have a project which has mostly static pages and few server-less APIs. The total size of the static contents (mostly images) are more than 50MB. But, the server-less functions do not refer to these 50MB image files. According to the documentation, the 50MB limit enforced by AWS should not apply here (since these images get uploaded to CDN and not AWS). So the build should succeed.
However the build fails while using Next 12 and works perfectly fine while using Next 11. Here is the minimal reproducible sample:
Error screenshot:
My suspect is something broke between Next 11 and Next 12 on the size calculation.
Note: This is NOT a duplicate of #103 and creating this new discussion as per the comment.
Beta Was this translation helpful? Give feedback.
All reactions