-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
vercel deploy uploads ~300MB for non-prebuilt Next.js app when .vercel/repo.json exists at repo root
Summary
In a PNPM monorepo, running vercel deploy --prod for a non-prebuilt Next.js app triggers an upload of ~300 MB.
This only happens when a .vercel/repo.json file exists at the repository root (needed to deploy other prebuilt apps).
Removing the file avoids the huge upload, but then I can’t deploy the prebuilt apps in the same monorepo.
I need to keep .vercel/repo.json for the prebuilt apps and deploy this one app as non-prebuilt (for sharp/image support), but the CLI behavior forces a 300 MB upload.
Reproduction
Monorepo layout (simplified)
/<monorepo-root>
/.vercel/repo.json <-- required for other prebuilt apps
/<path-to-apps>/
/<prebuilt-app-1> <-- prebuilt app
/<prebuilt-app-2> <-- prebuilt app
/<non-prebuilt-app> <-- Next.js app that should build on Vercel
/<path-to-apps>/<non-prebuilt-app>/package.json
{
"name": "<non-prebuilt-app>",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"deploy": "vercel deploy --prod"
},
"dependencies": {
"next": "14.3.0-canary.42",
"react": "18",
"react-dom": "18",
"sharp": "0.34.3"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.3.0-canary.42",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
}
}Root .vercel/repo.json (excerpt)
{
"orgId": "<org_id>",
"remoteName": "origin",
"projects": [
{ "id": "<project_id_1>", "name": "<prebuilt-app-1>", "directory": "<path-to-apps>/<prebuilt-app-1>" },
{ "id": "<project_id_2>", "name": "<prebuilt-app-2>", "directory": "<path-to-apps>/<prebuilt-app-2>" },
{ "id": "<project_id_3>", "name": "<non-prebuilt-app>", "directory": "<path-to-apps>/<non-prebuilt-app>" }
]
}Commands
cd <path-to-apps>/<non-prebuilt-app>
vercel deploy --prodObserved (Vercel CLI 41.6.0)
Vercel CLI 41.6.0
: Uploading [--------------------] (10.0MB/303MB)
With .vercel/repo.json present, it uploads ~300 MB.
If I temporarily remove .vercel/repo.json, the upload doesn’t happen and deploy behaves like a normal server build.
Expected behavior
- For a non-prebuilt Next.js app, the CLI should not upload hundreds of MB; it should build on Vercel (same behavior as when
.vercel/repo.jsonis absent). - The presence of
.vercel/repo.jsonshould not change deploy behavior for apps not using--prebuilt.
Actual behavior
- With
.vercel/repo.jsonpresent,vercel deploy --produploads ~300 MB. - Removing
.vercel/repo.jsonavoids the upload but breaks prebuilt deploys for other apps in the monorepo.
Why this matters
- The non-prebuilt app must build on Vercel to use runtime modules like
sharp. - I still need
.vercel/repo.jsonto deploy other apps as prebuilt. - Currently I can’t do both.
Environment
- Vercel CLI: 41.6.0
- Next.js: 14.3.0-canary.42
- Node: 18.x
- Package manager: pnpm
- OS: macOS
- Monorepo: yes
Hypothesis
When .vercel/repo.json exists, the CLI may treat the deploy as if it were prebuilt or expand the workspace context, causing a massive upload from the monorepo even without --prebuilt.
Request
-
Confirm whether this is a CLI bug with project resolution when
.vercel/repo.jsonis present in a monorepo. -
Provide a flag or config to force non-prebuilt behavior for a specific app while keeping
.vercel/repo.json. -
Share any workaround that allows:
- keeping
.vercel/repo.jsonfor prebuilt apps, and - deploying this app without the 300 MB upload.
- keeping