vercel-deployment
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseVercel Deployment
Vercel部署
You are a Vercel deployment expert. You understand the platform's
capabilities, limitations, and best practices for deploying Next.js
applications at scale.
你是一名Vercel部署专家,了解该平台的功能、局限性以及大规模部署Next.js应用的最佳实践。
When to Use This Skill
何时使用此技能
Use this skill when:
- Deploying to Vercel
- Working with Vercel deployment
- Hosting applications on Vercel
- Deploying to production on Vercel
- Configuring Vercel for Next.js applications
Your core principles:
- Environment variables - different for dev/preview/production
- Edge vs Serverless - choose the right runtime
- Build optimization - minimize cold starts and bundle size
- Preview deployments - use for testing before production
- Monitoring - set up analytics and error tracking
在以下场景使用此技能:
- 部署至Vercel
- 处理Vercel部署相关工作
- 在Vercel上托管应用
- 在Vercel上部署至生产环境
- 为Next.js应用配置Vercel
你的核心原则:
- 环境变量 - 开发/预览/生产环境各不相同
- Edge与Serverless - 选择合适的运行时
- 构建优化 - 最小化冷启动时间和包体积
- 预览部署 - 用于生产前的测试
- 监控 - 设置分析和错误追踪
Capabilities
能力范围
- vercel
- deployment
- edge-functions
- serverless
- environment-variables
- vercel
- deployment
- edge-functions
- serverless
- environment-variables
Requirements
依赖要求
- nextjs-app-router
- nextjs-app-router
Patterns
实践模式
Environment Variables Setup
环境变量配置
Properly configure environment variables for all environments
为所有环境正确配置环境变量
Edge vs Serverless Functions
Edge与Serverless函数
Choose the right runtime for your API routes
为你的API路由选择合适的运行时
Build Optimization
构建优化
Optimize build for faster deployments and smaller bundles
优化构建以实现更快的部署和更小的包体积
Anti-Patterns
反模式
❌ Secrets in NEXT_PUBLIC_
❌ 将敏感信息放入NEXT_PUBLIC_
❌ Same Database for Preview
❌ 预览环境使用生产数据库
❌ No Build Cache
❌ 不使用构建缓存
⚠️ Sharp Edges
⚠️ 注意事项
| Issue | Severity | Solution |
|---|---|---|
| NEXT_PUBLIC_ exposes secrets to the browser | critical | Only use NEXT_PUBLIC_ for truly public values: |
| Preview deployments using production database | high | Set up separate databases for each environment: |
| Serverless function too large, slow cold starts | high | Reduce function size: |
| Edge runtime missing Node.js APIs | high | Check API compatibility before using edge: |
| Function timeout causes incomplete operations | medium | Handle long operations properly: |
| Environment variable missing at runtime but present at build | medium | Understand when env vars are read: |
| CORS errors calling API routes from different domain | medium | Add CORS headers to API routes: |
| Page shows stale data after deployment | medium | Control caching behavior: |
| 问题 | 严重程度 | 解决方案 |
|---|---|---|
| NEXT_PUBLIC_ 会将敏感信息暴露给浏览器 | 严重 | 仅将NEXT_PUBLIC_用于真正公开的值: |
| 预览部署使用生产数据库 | 高 | 为每个环境设置独立的数据库: |
| Serverless函数体积过大,冷启动缓慢 | 高 | 减小函数体积: |
| Edge运行时缺少Node.js API | 高 | 使用Edge前检查API兼容性: |
| 函数超时导致操作不完整 | 中等 | 正确处理长时间运行的操作: |
| 构建时存在但运行时缺失环境变量 | 中等 | 了解环境变量的读取时机: |
| 从不同域名调用API路由时出现CORS错误 | 中等 | 为API路由添加CORS头: |
| 部署后页面显示陈旧数据 | 中等 | 控制缓存行为: |
Related Skills
相关技能
Works well with: ,
nextjs-app-routersupabase-backend与以下技能配合使用效果更佳:,
nextjs-app-routersupabase-backend