Registry / devops / vite-plugin-vercel

vite-plugin-vercel

JSON →
library11.0.3jsnpmunverified

Vite adapter for Vercel that bundles applications according to the Vercel Output API. Version 11.0.3 requires Vite >=7.1. Supports SSG/static files, SSR/serverless functions with auto-bundling from the api folder, ISR/prerender functions, Edge functions and Edge middleware. Differentiates from @vercel/build by not forcing api folder builds, offering flexible endpoint mapping via getVercelEntries and per-endpoint configuration (edge, headers, streaming, isr). Actively maintained with frequent releases.

npm install vite-plugin-vercel
INSTALL
IMPORT
SIG · VITE-PLUGIN-VERCEL
V
vite-plugin-vercel
devopsjavascriptv11.0.3
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (vercel)
✓ import vercel from 'vite-plugin-vercel'
✗ const vercel = require('vite-plugin-vercel')
ESM-only; cannot use require in CJS. Since v11, no default export is named, but the default export is the plugin function.
getVercelEntries
✓ import { getVercelEntries } from 'vite-plugin-vercel'
✗ const { getVercelEntries } = require('vite-plugin-vercel')
Named export, not available in CJS. Used to generate endpoint entries with auto-mapping.
type VercelOptions
✓ import type { VercelOptions } from 'vite-plugin-vercel'
✗ import { VercelOptions } from 'vite-plugin-vercel' (runtime import)
TypeScript type only; import type to avoid bundling issue.

Minimal Vite config with Vercel plugin, endpoint mapping via getVercelEntries, and a sample API route.

// vite.config.ts import { defineConfig } from 'vite'; import vercel from 'vite-plugin-vercel'; import { getVercelEntries } from 'vite-plugin-vercel'; const entries = await getVercelEntries('endpoints/api', { destination: 'api' }); export default defineConfig({ plugins: [vercel({ entries })] }); // endpoints/api/hello.ts export default async function handler(request: Request): Promise<Response> { return new Response('Hello, Vercel!', { status: 200 }); }
Debug
Known issues
breakingVersion 11 dropped support for Vite 6 and earlier. Only Vite >=7.1 is supported.
fix
Upgrade Vite to >=7.1 or stay on v10.x
affects: >=11.0.0
breakingDefault export renamed in v7 from createVercel to vercel plugin function.
fix
Use `import vercel from 'vite-plugin-vercel'` instead of `import createVercel`
affects: >=7.0.0 <11
gotchaIf you place files inside the /api folder, @vercel/build will force-bundle them. Use a different folder like endpoints/api and map with getVercelEntries.
fix
Move API files to a custom folder (e.g., endpoints/api) and configure entries accordingly.
affects: >=0.0.0
deprecatedThe `additionalEndpoints` config option is deprecated in favor of `getVercelEntries` since v10.
fix
Use getVercelEntries to define endpoints programmatically.
affects: >=10.0.0
gotchaEdge functions using `export const edge = true` must return a Response object; streaming responses require `export const streaming = true`.
fix
Ensure edge function handlers return Response and set streaming flag if needed.
affects: >=0.0.0
Errors
Common errors & fixes
Error: require() of ES Module not supported: vite-plugin-vercel
Using CommonJS require to import an ESM-only package.
fix
Switch to ESM by using import statements or set "type": "module" in package.json.
Module not found: Can't resolve 'vite-plugin-vercel'
Package not installed or missing from node_modules.
fix
Run npm install -D vite-plugin-vercel (or equivalent with yarn/pnpm/bun).
TypeError: vercel is not a function
Importing the default export incorrectly (e.g., using named import for default).
fix
Use `import vercel from 'vite-plugin-vercel'` (default import).
Serverless Function timed out (maxDuration exceeded)
Function execution exceeded the defaultMaxDuration set in config or Vercel plan limit.
fix
Increase defaultMaxDuration in plugin options or optimize function code.
Error: getVercelEntries is not defined
Using CJS require or incorrect named import.
fix
Use `import { getVercelEntries } from 'vite-plugin-vercel'` in an ESM context.
Upgrade
Version history
11.0.3latest on npm
Audit
Dependencies
viterequiredpeer dependency, required as the build tool; version >=7.1
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
vite-plugin-vercel — npm install vite-plugin-vercel · libregistry