# vite-plugin-vercel

> Vercel adapter for vite

Latest version **11.1.1** (published 2026-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install vite-plugin-vercel
pnpm add vite-plugin-vercel
yarn add vite-plugin-vercel
bun add vite-plugin-vercel
```

## Health

**Score 55/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 11.1.1 |
| Published | 2026-06-08 |
| First published | 2021-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 14 |
| Unpacked size | 52.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 129 |
| Author | Joël Charles |
| Maintainers | magne4000, brillout |

## Links

- npm: https://www.npmjs.com/package/vite-plugin-vercel
- Repository: https://github.com/magne4000/vite-plugin-vercel
- Homepage: https://github.com/magne4000/vite-plugin-vercel#readme
- Issues: https://github.com/magne4000/vite-plugin-vercel/issues
- npm.io page: https://npm.io/package/vite-plugin-vercel

## Dependencies (14)

- [nf3](https://npm.io/package/nf3.md) ^0.3.17
- [p-limit](https://npm.io/package/p-limit.md) ^7.3.0
- [magicast](https://npm.io/package/magicast.md) ^0.5.3
- [rolldown](https://npm.io/package/rolldown.md) ^1.1.0
- [fast-glob](https://npm.io/package/fast-glob.md) ^3.3.3
- [@vercel/nft](https://npm.io/package/@vercel/nft.md) ^1.10.2
- [convert-route](https://npm.io/package/convert-route.md) ^1.1.1
- [oxc-transform](https://npm.io/package/oxc-transform.md) ^0.134.0
- [@manypkg/find-root](https://npm.io/package/@manypkg/find-root.md) ^3.1.0
- [@vercel/build-utils](https://npm.io/package/@vercel/build-utils.md) ^13.27.1
- [@vercel/routing-utils](https://npm.io/package/@vercel/routing-utils.md) ^6.2.0
- [@universal-deploy/vite](https://npm.io/package/@universal-deploy/vite.md) ^0.1.10
- [@universal-deploy/store](https://npm.io/package/@universal-deploy/store.md) ^0.2.1
- [@vite-plugin-vercel/schemas](https://npm.io/package/@vite-plugin-vercel/schemas.md) ^1.1.1

## Recent versions

- 11.1.1 (latest) — 2026-06-08
- 11.0.0-beta.23 (beta) — 2026-03-11
- 11.1.0 — 2026-05-11
- 11.0.3 — 2026-03-18
- 11.0.2 — 2026-03-18
- 11.0.1 — 2026-03-18
- 11.0.0 — 2026-03-18
- 11.0.0-beta.22 — 2026-03-09
- 11.0.0-beta.21 — 2026-03-04
- 11.0.0-beta.20 — 2026-03-04
- 11.0.0-beta.19 — 2026-03-04
- 11.0.0-beta.18 — 2026-03-04
- 11.0.0-beta.17 — 2026-03-04
- 11.0.0-beta.16 — 2026-03-04
- 11.0.0-beta.15 — 2026-03-04
- … 83 more at https://npm.io/package/vite-plugin-vercel/versions

## README

# vite-plugin-vercel

Vercel adapter for [Vite](https://vitejs.dev/).

Bundle your Vite application as supported by [Vercel Output API](https://vercel.com/docs/build-output-api).

## Install

```bash
npm i -D vite-plugin-vercel
```

```bash
yarn add -D vite-plugin-vercel
```

```bash
pnpm add -D vite-plugin-vercel
```

```bash
bun add -D vite-plugin-vercel
```

## Features

- [x] [SSG/Static files](https://vercel.com/docs/build-output-api/v3/primitives#static-files)
    - see [`prerender` config](/packages/vercel/src/types.ts#L37)
- [x] [SSR/Serverless functions](https://vercel.com/docs/build-output-api/v3/primitives#serverless-functions)
    - `.[jt]s` files under the `<root>/api` folder of your project are automatically bundled as Serverless functions under `.vercel/output/functions/api/*.func`
    - see [`additionalEndpoints` config](/packages/vercel/src/types.ts#L62)
- [x] [ISR/Prerender functions](https://vercel.com/docs/build-output-api/v3/primitives#prerender-functions)
    - see [`isr` config](/packages/vercel/src/types.ts#L89). Also see implementation of [vike](/packages/vike-integration/vike.ts) for example
- [x] [Edge functions](https://vercel.com/docs/build-output-api/v3/primitives#edge-functions)
- [x] [Edge middleware](https://vercel.com/docs/functions/edge-middleware/middleware-api)
- [ ] [Images optimization](https://vercel.com/docs/build-output-api/v3/configuration#images)
- [ ] [Preview mode](https://vercel.com/docs/build-output-api/v3/features#preview-mode)
- [x] [Advanced config](/packages/vercel/src/types.ts#L19)
- [x] [Queues](https://vercel.com/docs/queues)

## Simple usage

Install this package as a dev dependency and add it to your Vite config:

```ts
// 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", {
  // Auto mapping examples:
  //   endpoints/api/page.ts -> /api/page
  //   endpoints/api/name/[name].ts -> /api/name/*
  destination: "api",
});

export default defineConfig({
  plugins: [vercel({
    entries,
  })],
});
```

> [!NOTE]
> `@vercel/build` forces the building of files in the _/api_ folder, with no way to disable this behavior.
> It's recommended to place your files in a different folder.

### Configure endpoints

Endpoints added via `getVercelEntries` can be configured by exporting values from the endpoint file:

```ts
// file: endpoints/api/endpoint.ts

// Should run on edge runtime
export const edge = true;

// Always add those header to this endpoint
export const headers = {
  'Some-Header': 'some value',
};

// Stream the response
export const streaming = true;

// Enable Incremental Static Regeneration for this endpoint
export const isr = {
  expiration: 30,
};

export default async function handler() {
  return new Response('Edge Function: OK', {
    status: 200,
  });
}
```

### Edge middleware

You can use [Edge middleware as describe in the official documentation](https://vercel.com/docs/functions/edge-middleware/middleware-api) (i.e. with a `middleware.ts` file at the root of your project).

## Advanced settings

```ts
// vite.config.ts
import { defineConfig } from 'vite';
import vercel from 'vite-plugin-vercel';

export default defineConfig({
  plugins: [vercel({
    // All the followings are optional

    /**
     * How long Functions should be allowed to run for every request, in seconds.
     * If left empty, default value for your plan will be used.
     */
    defaultMaxDuration: 30,
    /**
     * Enable streaming responses by default for all Serverless Functions
     */
    defaultSupportsResponseStreaming: true,
    /**
     * Default expiration time (in seconds) for prerender functions.
     * Defaults to 86400 seconds (24h).
     */
    expiration: 86400,

    /**
     * See https://vercel.com/docs/projects/project-configuration#rewrites
     */
    rewrites: [{ source: '/about', destination: '/about-our-company.html' }],
    /**
     * @see {@link https://vercel.com/docs/projects/project-configuration#headers}
     */
    headers: [
      {
        "source": "/service-worker.js",
        "headers": [
          {
            "key": "Cache-Control",
            "value": "public, max-age=0, must-revalidate"
          }
        ]
      }
    ],
    /**
     * See https://vercel.com/docs/projects/project-configuration#redirects
     */
    redirects: [
      { source: '/me', destination: '/profile.html', permanent: false },
    ],
    /**
     * See https://vercel.com/docs/projects/project-configuration#cleanurls
     */
    cleanUrls: true,
    /**
     * See https://vercel.com/docs/projects/project-configuration#trailingslash
     */
    trailingSlash: true,
    /**
     * Use `getVercelEntries` for mapping your filesystem routes to entries.
     * If you are interfacing this plugin with a framework, entries can also be added through the {@link https://github.com/photon-js/universal-deploy | universal-deploy} API
     */
    entries: {
      root: {
        id: 'src/routes/root.ts',
        name: 'root',
        route: '/'
      }
    },
    /**
     * Advanced configuration to override .vercel/output/config.json
     * See https://vercel.com/docs/build-output-api/v3/configuration#configuration
     */
    config: {
      // routes?: Route[];
      // images?: ImagesConfig;
      // wildcard?: WildcardConfig;
      // overrides?: OverrideConfig;
      // cache?: string[];
      // crons?: CronsConfig;
    },
    /**
     * Defaults to `.vercel/output`. Mostly useful for testing purpose
     */
    outDir: '.vercel/output',
  })]
});
```

## FAQ

### What does ISR do in dev mode?
Nothing. It's a production-only feature

### What does `edge: true` target do in dev mode?
Nothing (yet?). If you have a use-case where an actual Edge runtime would be necessary in dev, please open a discussion

### I don't see Vercel specific headers in dev mode
This is not yet supported. Please open an issue if you need this (PR welcome).

Related documentation: https://vercel.com/docs/edge-network/headers/request-headers

## Migrations

- [Migration from v9 to v11](https://github.com/magne4000/vite-plugin-vercel/blob/main/MIGRATION.md)

## Demo

https://vite-plugin-vercel-demo-roan.vercel.app/

---
_Source: https://npm.io/package/vite-plugin-vercel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
