Skip to main content

VercelConfig

The main configuration object for Vercel Build Output API v3.

Type definition

type VercelConfig = {
  version: 3;
  routes?: Route[];
  images?: ImagesConfig;
  wildcard?: WildcardConfig;
  overrides: OverridesConfig;
  cache?: string[];
}

Properties

version
3
required
Build Output API version. Always set to 3.
routes
Route[]
Array of routing rules defining how requests are handled. Includes rewrites, redirects, headers, and function mappings.
images
ImagesConfig
Image optimization configuration from Next.js image config.
wildcard
WildcardConfig
i18n domain wildcard configuration for locale-specific domains.
overrides
OverridesConfig
required
Map of file paths to override configurations for static files.
cache
string[]
Array of cache control patterns.

Example

const vercelConfig: VercelConfig = {
  version: 3,
  overrides: {},
  routes: [
    { handle: 'filesystem' },
    { src: '^/api/.*', dest: '/api/handler' },
  ],
  images: {
    sizes: [640, 750, 828, 1080, 1200],
    domains: ['example.com'],
    formats: ['image/avif', 'image/webp'],
  },
};

ImagesConfig

Configuration for Next.js Image Optimization.

Type definition

type ImagesConfig = {
  sizes: number[];
  domains: string[];
  remotePatterns?: RemotePattern[];
  localPatterns?: LocalPattern[];
  qualities?: number[];
  minimumCacheTTL?: number;
  formats?: ImageFormat[];
  dangerouslyAllowSVG?: boolean;
  contentSecurityPolicy?: string;
  contentDispositionType?: string;
}

Properties

sizes
number[]
required
Array of allowed image widths. Combines imageSizes and deviceSizes from Next.js config.
domains
string[]
required
Allowed domains for remote images.
remotePatterns
RemotePattern[]
Pattern-based remote image configuration with regex support.
localPatterns
LocalPattern[]
Pattern-based local image configuration.
qualities
number[]
Allowed quality values for image optimization.
minimumCacheTTL
number
Minimum cache TTL in seconds for optimized images.
formats
ImageFormat[]
Allowed image formats for optimization.
dangerouslyAllowSVG
boolean
Whether to allow SVG image optimization.
contentSecurityPolicy
string
Content Security Policy for images.
contentDispositionType
string
Content-Disposition header type for images.

Example

const imagesConfig: ImagesConfig = {
  sizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
  domains: ['example.com', 'cdn.example.com'],
  remotePatterns: [
    {
      protocol: 'https',
      hostname: '**.example.com',
      pathname: '/images/**',
    },
  ],
  formats: ['image/avif', 'image/webp'],
  minimumCacheTTL: 60,
};

WildcardConfig

Configuration for i18n domain wildcards.

Type definition

type WildcardConfig = Array<WildCard>

type WildCard = {
  domain: string;
  value: string;
}

Properties

domain
string
required
The domain name for this locale.
value
string
required
The path prefix for the locale. Empty string for default locale.

Example

const wildcardConfig: WildcardConfig = [
  {
    domain: 'example.com',
    value: '', // default locale
  },
  {
    domain: 'example.fr',
    value: '/fr',
  },
];

Notes

Generated from Next.js i18n.domains configuration. The value is:
  • Empty string for the default locale
  • /{locale} for non-default locales

OverridesConfig

Configuration for static file overrides.

Type definition

type OverridesConfig = Record<
  string,
  { path?: string; contentType?: string }
>

Structure

A record mapping file paths to override configurations.
[key]
string
required
The file path to override (e.g., "./about.html").
[key].path
string
The URL path to serve the file at (e.g., "./about").
[key].contentType
string
The Content-Type header to use (e.g., "text/html; charset=utf-8").

Example

const overrides: OverridesConfig = {
  './about.html': {
    path: './about',
    contentType: 'text/html; charset=utf-8',
  },
  './feed.xml': {
    contentType: 'application/xml',
  },
};

Use case

Primarily used for:
  • Serving HTML files without .html extension
  • Setting correct content types for static files
  • Path rewriting for static assets

FuncOutputs

Type representing function outputs from Next.js build.

Type definition

type FuncOutputs = Array<
  | AdapterOutput['PAGES']
  | AdapterOutput['APP_PAGE']
  | AdapterOutput['APP_ROUTE']
  | AdapterOutput['PAGES_API']
  | AdapterOutput['MIDDLEWARE']
>

Description

Union type of all possible function output types from the Next.js adapter. Each output includes:
  • pathname: URL pathname
  • id: Unique identifier
  • filePath: Path to function entry
  • assets: Required asset files
  • runtime: “nodejs” or “edge”
  • sourcePage: Original page path
  • config: Function configuration

Example usage

const nodeOutputs: FuncOutputs = [];
const edgeOutputs: FuncOutputs = [];

for (const output of [
  ...outputs.appPages,
  ...outputs.appRoutes,
  ...outputs.pages,
  ...outputs.pagesApi,
]) {
  if ('runtime' in output) {
    if (output.runtime === 'nodejs') {
      nodeOutputs.push(output);
    } else if (output.runtime === 'edge') {
      edgeOutputs.push(output);
    }
  }
}

NodeFunctionConfig

Configuration for Node.js serverless functions.

Type definition

type NodeFunctionConfig = Pick<
  NodejsLambda,
  | 'memory'
  | 'maxDuration'
  | 'experimentalTriggers'
  | 'supportsCancellation'
  | 'handler'
  | 'runtime'
  | 'regions'
  | 'allowQuery'
  | 'framework'
  | 'operationType'
  | 'supportsMultiPayloads'
  | 'supportsResponseStreaming'
  | 'experimentalAllowBundling'
> & {
  filePathMap: Record<string, string>;
  useWebApi?: boolean;
  launcherType: 'Nodejs';
}

Properties

filePathMap
Record<string, string>
required
Map of required files (relative to repo root).
handler
string
required
Path to the function handler file.
runtime
string
required
Node.js runtime version (e.g., “nodejs20.x”).
operationType
'PAGE' | 'API'
required
Type of operation this function performs.
framework
{ slug: string; version: string }
required
Framework metadata. For Next.js: { slug: 'nextjs', version: '14.1.0' }.
maxDuration
number
Maximum execution duration in seconds.
supportsMultiPayloads
boolean
Whether the function supports multiple payloads. Always true for Next.js.
supportsResponseStreaming
boolean
Whether the function supports streaming responses. Always true for Next.js.
experimentalAllowBundling
boolean
Whether to allow bundling. Always true for Next.js.
useWebApi
boolean
Whether to use Web API (Request/Response) instead of Node.js API. true for middleware.
launcherType
'Nodejs'
required
Launcher type identifier.

EdgeFunctionConfig

Configuration for Edge Functions.

Type definition

type EdgeFunctionConfig = {
  runtime: 'edge';
  name: string;
  entrypoint: string;
  environment: Record<string, string>;
  filePathMap: Record<string, string>;
  assets?: Array<{ name: string; path: string }>;
  deploymentTarget: string;
  regions?: 'all' | string | string[];
  framework?: { slug: string; version: string };
}

Properties

runtime
'edge'
required
Runtime identifier for Edge Functions.
name
string
required
Function name.
entrypoint
string
required
Path to the function entrypoint.
filePathMap
Record<string, string>
required
Map of JavaScript files required by the function.
assets
Array<{ name: string; path: string }>
Non-JavaScript assets (WASM, JSON, etc.).
deploymentTarget
string
required
Deployment target. Always "v8-worker" for Edge Functions.
environment
Record<string, string>
required
Environment variables for the function.
regions
'all' | string | string[]
Deployment regions for the function.
framework
{ slug: string; version: string }
Framework metadata.

Example

const edgeConfig: EdgeFunctionConfig = {
  runtime: 'edge',
  name: 'middleware',
  entrypoint: 'middleware/index.js',
  filePathMap: {
    'middleware.js': 'middleware.js',
  },
  assets: [
    { name: 'data.json', path: 'assets/data.json' },
  ],
  deploymentTarget: 'v8-worker',
  environment: {},
  regions: 'all',
  framework: {
    slug: 'nextjs',
    version: '14.1.0',
  },
};

Build docs developers (and LLMs) love