fix: exclude build artifacts to prevent 250MB limit errors in monorepos #592
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When using
vercel-phpin modern monorepo setups (Turbo, Next.js, Nuxt, SvelteKit, etc.), deployments fail with:Root Cause
The PHP runtime bundles all files from
workPathinto each serverless function, excluding only:node_modules/**Modern frameworks generate large build artifacts (
.next/,.turbo/, etc.) that weren't common when this runtime was created. These directories get included in every PHP function, causing massive bundle sizes.Real-World Example
In a Turbo monorepo with Next.js:
.next/folder: 662 MB (mostly webpack cache)Solution
Update the default
excludeFileslist to exclude common modern build directories:.next/**- Next.js build output.turbo/**- Turbo cachedist/**- Common build output.cache/**- General build caches.nuxt/**- Nuxt.js build.svelte-kit/**- SvelteKit build.output/**- Nitro/Nuxt outputAdditional Context
This issue became prominent with the rise of: