본문으로 건너뛰기
cccskills
무료GitHub에 공개

vercel-nextjs-config

Configure a Next.js app for Vercel. next.config versus vercel.json, proxy (renamed from middleware in Next.js 16), images, redirects and headers, function duration and region, caching and static export pitfalls, and local verification. Use when editing next.config, vercel.json or routing for a Next.js project on Vercel.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Vercel
설치 방법 보기

포함된 파일(1)

  • SKILL.md5.3 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Next.js configuration on Vercel

Vercel detects Next.js and builds it with no configuration. Add configuration only for a reason you can name. First read: package.json (next version), the existing next.config.*, and vercel.json if present. Version matters: check https://nextjs.org/docs and https://vercel.com/docs (append .md to a Vercel docs URL for plain text) before relying on memory for anything below.

Where each setting lives

SettingPut it inWhy
Redirects, rewrites, headers for the app's routesnext.config.ts (redirects(), rewrites(), headers())version-controlled with the app, works in next dev
Platform behavior: crons, regions, per-function memory/maxDuration, ignoreCommand, buildCommand/installCommand, outputDirectoryvercel.json (or vercel.ts)Vercel-only features
Secrets and per-environment valuesVercel environment variables (vercel-env-vars)never in either file
Project name, Node version, root directory, Git settingsProject Settingsdashboard-only

Do not define the same redirect in both files. Only one of vercel.json, vercel.toml and vercel.ts may exist. A vercel.json that mixes legacy routes with rewrites/redirects/headers is rejected.

A sensible next.config.ts

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  images: {
    // Allow only the hosts you serve images from.
    remotePatterns: [{ protocol: "https", hostname: "images.example.com", pathname: "/**" }],
  },
  async redirects() {
    return [{ source: "/old", destination: "/new", permanent: true }];
  },
  async headers() {
    return [{ source: "/(.*)", headers: [{ key: "X-Content-Type-Options", value: "nosniff" }] }];
  },
};

export default nextConfig;
  • output: "standalone" is for self-hosting in a container. It is not needed on Vercel.
  • output: "export" produces a static site. Redirects, rewrites, headers and server features (proxy, route handlers that read the request, ISR) do not run in a static export; define redirects and headers in vercel.json instead, or do not export.
  • Do not set typescript.ignoreBuildErrors or eslint.ignoreDuringBuilds to make a deploy pass; fix the errors or tell the user they are being skipped.
  • images.remotePatterns is an allow list: a wildcard host lets anyone use your image optimizer as a proxy and increases cost.

Proxy (formerly middleware)

Next.js 16 renamed the middleware file convention to proxy (proxy.ts at the project root or in src/, exporting proxy); the Node.js runtime is the default and a runtime export is not allowed there. Migrate with npx @next/codemod@canary middleware-to-proxy . (show the diff first).

  • Without a matcher, it runs on every request including _next/static, images and public/ files. Exclude them or auth logic will break CSS and JS: matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"].
  • Server Functions are POSTs to the page route; a matcher that skips the page also skips them. Check authorization inside each Server Function, not only in proxy.
  • It does not work with output: "export".

Environment variables in Next.js

  • NEXT_PUBLIC_* values are inlined into the browser bundle at build time. Never use that prefix for a secret. Changing one needs a rebuild.
  • Server-only variables are read from process.env in Server Components, Route Handlers and Server Functions only.
  • .env.local is for local development and must be gitignored. Use vercel env pull / vercel env run for team values.

Functions, caching and rendering

  • Per-route duration: export const maxDuration = 30; in the route segment, or functions in vercel.json. Limits depend on plan; check the docs.
  • Regions: regions in vercel.json; put functions near the database.
  • Next.js 16 Cache Components (cacheComponents: true) makes data dynamic by default and caches with the use cache directive; do not enable it in an existing app without reading the migration guide and running the build.
  • ISR: fetch(url, { next: { revalidate: 60 } }) or export const revalidate.
  • export const dynamic = "force-dynamic" on a page that could be static costs money and speed; use it only when needed.

Verify locally before any deploy

  1. npm run build (or the project's build) must pass with no skipped checks.
  2. npx vercel build after vercel pull reproduces Vercel's build; it needs the user's login for pull.
  3. Run the production build locally (next start) and request the routes you changed, including a redirect, a header, and a proxy-protected path.
  4. Run /vercel-preflight.
  5. Deploying is a separate step: follow vercel-deploy, preview first, with the user's approval.

Done means

You report the commands you ran and what they printed (build success, status codes of the routes you requested), what you changed in which file and why, and anything you could not verify without a deployment.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Audit a page or UI against WCAG 2.2 AA. Runs a static HTML scanner and a contrast calculator, then walks the manual keyboard, zoom, screen-reader-name and form checks the tools cannot do, and reports findings with the criterion, evidence, fix and how to verify. Use for accessibility reviews, WCAG checks, contrast questions or "is this accessible".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 21일 업데이트

batch

무료

Break a large, parallelizable goal into bounded work units, coordinate existing agent/worktree machinery, integrate, and verify. Explicit-only.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 21일 업데이트

best-of-n

무료

Generate a small set of independent candidate solutions in worktrees, judge them against one explicit rubric, and apply the winner only after PASS verification.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 21일 업데이트

Read and act on selected Chrome tabs and frames — their real browser, their logged-in sessions. Use for questions about the current page, filling a form the user is on, following a link they mentioned, or checking what a site actually renders. Not for throwaway automation in a clean profile.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 21일 업데이트

Deploy or change a Cloudflare Worker with cf. Review config, preflight, build and dry-run; show the target and change, obtain explicit approval, deploy and verify. Covers versions, secrets, rollback and named modes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 21일 업데이트

Look up current Cloudflare documentation (Workers, Pages, KV, R2, D1, Queues, DNS, WAF, platform APIs) through Cloudflare's official remote MCP server. Use when answering Cloudflare questions or writing Cloudflare config.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

codewhale-hq/codewhale-plugin-marketplace52026년 10월 21일 업데이트

codewhale-hq의 스킬 모두 보기

이 스킬의 문제 신고