2.1 KiB
2.1 KiB
Vercel Deployment
Turborepo integrates seamlessly with Vercel for monorepo deployments.
Remote Cache
Remote caching is automatically enabled when deploying to Vercel. No configuration needed - Vercel detects Turborepo and enables caching.
This means:
- No
TURBO_TOKENorTURBO_TEAMsetup required on Vercel - Cache is shared across all deployments
- Preview and production builds benefit from cache
turbo-ignore
Skip unnecessary builds when a package hasn't changed using turbo-ignore.
Installation
npx turbo-ignore
Or install globally in your project:
pnpm add -D turbo-ignore
Setup in Vercel
- Go to your project in Vercel Dashboard
- Navigate to Settings > Git > Ignored Build Step
- Select "Custom" and enter:
npx turbo-ignore
How It Works
turbo-ignore checks if the current package (or its dependencies) changed since the last successful deployment:
- Compares current commit to last deployed commit
- Uses Turborepo's dependency graph
- Returns exit code 0 (skip) if no changes
- Returns exit code 1 (build) if changes detected
Options
# Check specific package
npx turbo-ignore web
# Use specific comparison ref
npx turbo-ignore --fallback=HEAD~1
# Verbose output
npx turbo-ignore --verbose
Environment Variables
Set environment variables in Vercel Dashboard:
- Go to Project Settings > Environment Variables
- Add variables for each environment (Production, Preview, Development)
Common variables:
DATABASE_URLAPI_KEY- Package-specific config
Monorepo Root Directory
For monorepos, set the root directory in Vercel:
- Project Settings > General > Root Directory
- Set to the package path (e.g.,
apps/web)
Vercel automatically:
- Installs dependencies from monorepo root
- Runs build from the package directory
- Detects framework settings
Build Command
Vercel auto-detects turbo run build when turbo.json exists at root.
Override if needed:
turbo run build --filter=web
Or for production-only optimizations:
turbo run build --filter=web --env-mode=strict