Deploy Next.js
Leash detects Next.js automatically from your package.json. Before deploying, it runs a preflight build locally to catch errors early.
Auto-Detection
If your project has a package.json with a next dependency or a next.config.* file, Leash automatically selects the Next.js build strategy.
Terminal
$ cd my-nextjs-app
$ leash deploy
✓ Detected Next.js 15
✓ Preflight build passed
✓ Image built and pushed
✓ Deployed successfully!
→ https://my-nextjs-app-arvin.un.leash.build
Preflight Build
Leash runs npm run build locally before uploading your code. This catches errors fast and saves time.
What the preflight checks
- Runs
npm run buildlocally - Catches type errors before remote build
- Validates that the build output is correct
Common Issue: TypeScript Target
Build fails with syntax errors?
Your tsconfig.json may be targeting ES5, which causes issues with modern syntax. Update it to a modern version:
{"compilerOptions": {"target": "ES2017","module": "esnext"}}