NextAdapter
TheNextAdapter interface defines the contract for adapting Next.js builds to the Vercel platform.
Properties
The name of the adapter. For the Vercel adapter, this is set to
"Vercel".Async function called when the Next.js build is complete. Transforms build outputs into Vercel deployment format.
onBuildComplete
TheonBuildComplete hook is the core function that transforms Next.js build outputs into the Vercel Build Output API format.
Parameters
The function receives a single configuration object with the following properties:Routing configuration from Next.js build including rewrites, redirects, headers, and dynamic routes.
Next.js configuration object including basePath, i18n, images, and other settings.
Unique identifier for the current build.
Collection of all build outputs categorized by type.
Absolute path to the
.next build directory.Absolute path to the repository root directory.
Absolute path to the Next.js project directory.
Version string of Next.js being used (e.g., “14.1.0”).
Return value
Returns aPromise<void> that resolves when all build outputs have been processed and written to the Vercel output directory.
Behavior
TheonBuildComplete hook performs the following operations:
- Creates the Vercel output directory at
{distDir}/output - Processes public files and static outputs
- Handles Edge Functions and Node.js functions
- Processes middleware if present
- Handles prerender outputs for ISR/SSG pages
- Generates the routing configuration
- Writes the final
config.jsonfile
Notes
- The adapter handles both Node.js and Edge runtime outputs
- Middleware is supported for both runtimes
- Static files are optimized with content-type overrides
- i18n configuration is transformed into Vercel wildcard routing
- The adapter preserves ISR and PPR (Partial Prerendering) configurations