.env.local.production

The file .env.local.production is a non-standard configuration file used to define local, environment-specific overrides for a production build. In modern web frameworks like Next.js and Vite, it is designed to store machine-specific secrets that should never be committed to version control. Core Function and Priority

vercel env add API_KEY production

1. Debugging Production Builds

You are seeing a bug in your live site, but not in your local development server. You need to run next build or npm run build locally to replicate the environment exactly. By using .env.local.production, you can point your local production build to the real production API keys to debug the issue effectively. .env.local.production

# .github/workflows/deploy.yml
- name: Create .env.production.local
  run: |
    echo "BUILD_CACHE_TOKEN=$ secrets.CI_TOKEN " > .env.production.local
    npm run build