---
url: https://edgefit.kitdev.space/targets/vercel-edge.md
description: >-
  Vercel Edge runtime compatibility with edgefit, experimental: Node.js modules
  Vercel allows, Next.js middleware, and how process and require are handled.
---

# Vercel Edge runtime compatibility

Target name: `vercel-edge`. **Experimental.**

```sh
npx edgefit check --target vercel-edge
```

::: warning Read this first
Vercel recommends the Node.js runtime for functions and calls standalone Edge Functions deprecated. [Routing Middleware](https://vercel.com/docs/routing-middleware) still runs on the edge runtime by default, and that is the main use this target is for.
:::

## What the data covers

Vercel's Edge runtime is its own V8 runtime, not workerd, Deno or Node, and Vercel publishes no compatibility dump for it. So this target is built from Vercel's [Edge Runtime documentation](https://vercel.com/docs/functions/runtimes/edge) as of 2026-08-03:

* **Node modules.** Only five are allowed, with or without the `node:` prefix: `events`, `buffer`, `assert`, `async_hooks` and `util`. The documentation says which modules; it does not say which members of each exist. Those come from two pieces of Vercel's own code that list them identically: `NativeModuleMap` in Next.js's edge sandbox (`next@16.3.8`) and in `@vercel/node`'s dev server (`17.0.0`). Every member they do not list is reported as missing, so `buffer.Blob`, `events.getEventListeners`, `assert.partialDeepStrictEqual`, `util.inspect` and `async_hooks.createHook` are errors, and `util.format` and `util.inherits`, which the documentation does not mention, are not. Every other built-in, such as `fs`, `path` or `crypto`, is reported as missing.
* **Globals.** `Buffer`, `process.env` and the Web APIs the documentation lists. The ECMAScript builtins of V8 (`Uint16Array`, `WeakMap`, `globalThis` and the rest) are kept, and so are a few web globals the documentation's table omits but Vercel's own emulator provides (`queueMicrotask`, `performance`, `WebSocket` and others). Node-only globals such as `setImmediate` and `global` are reported as missing.
* **Disabled features.** `eval`, `WebAssembly.compile` and `Function(string)` are reported as unsupported. `WebAssembly.instantiate` is reported as a warning (`mismatch`) when its first argument is not a module from `import mod from './x.wasm'` (or `'./x.wasm?module'`), for example bytes from `fetch` or `readFile`. A parameter is reported too, because edgefit cannot see what the caller passes. `Function(string)` is a call of the `Function` constructor with an argument, `new Function('a', 'return a')` for example. `Function('return this')`, the classic way to reach the global object, is not counted, since code that uses it checks for `globalThis` first.
* **Other Web APIs** come from the `edge-light` column of runtime-compat-data, as warnings at the `web` level.

Anything the documentation does not list is reported as missing, so if Vercel adds something before the data catches up you see a false error, not a false pass.

## Entry detection

If the project root, or `src/`, has a `middleware.ts` (or `.js`, `.mts`, `.mjs`), it is the entry. Otherwise pass `--entry`.

* A middleware that sets `export const config = { runtime: 'nodejs' }` (Next.js 15.5 and later) runs on Node.js, so it is not used as the entry and the report says why.
* `proxy.ts` is not picked up. Next.js 16 renamed middleware to proxy, and its own build rejects route segment config in a proxy file with "Proxy always runs on Node.js runtime", so the Edge runtime does not run it.
* Edge Functions that are not middleware (`export const runtime = 'edge'` in a route, or `config.runtime` in `api/`) are not found yet. Pass `--entry` for them.

## Export conditions

Packages are resolved for the browser with the `edge-light` condition, then `module`, `import` and `default`. `worker` is not used. This follows the Next.js resolver for Edge code. Edge Functions built outside Next.js may resolve `module` differently.

## Importing a Node.js module Vercel lacks

Importing `node:fs`, or any module outside the five, is not reported. Only reading from it is: a call, a property read or a construct, reported where it happens, so a runtime check around it applies. A named import (`import { readFileSync } from 'node:fs'`) counts where it is used, not on the import line.

This follows Next.js. Its edge build replaces a Node.js module it lacks with a stand-in (`globalThis.__import_unsupported`) that throws when something from it is used, so a library that imports `node:fs` at the top and only uses it on Node.js still loads. I read this in `next@16.3.8`, in the webpack build. I could not read Turbopack's build, and outside Next.js (a function bundled with esbuild, for example) an import of a module the runtime lacks may fail when the function loads. There the import is the failure, and this target will not report it.

The weekly check reads Next's own list of kept modules, which is the same five, and fails if the stand-in disappears.

## Runtime checks

Code behind one of these checks is treated as running on Vercel's Edge runtime only, and code behind the opposite check is not checked here:

* `typeof EdgeRuntime` compared with `'string'` (the form [Vercel documents](https://vercel.com/docs/functions/runtimes/edge#check-if-youre-running-on-the-edge-runtime)) or with `'undefined'`, with `===` or `!==`, or in the minified form `typeof EdgeRuntime < "u"`, and `globalThis.EdgeRuntime`.
* `process.env.NEXT_RUNTIME` compared with `'edge'` or `'nodejs'`. Next.js replaces it at build time, and Next itself and many libraries built for it branch on it.

## Next.js middleware

Next.js middleware is the main use of this target. A middleware that only imports `NextResponse` from `next/server` reports no finding from its source. Built with `vercel build`, the middleware and an Edge route report no error: the Edge route has four guarded findings in Next's own code, each with a reason (see [code a package ships and the target does not run](/guide/findings#code-a-package-ships-and-the-target-does-not-run)). Check the output with `edgefit check --target vercel-edge --built .vercel/output`. See [Framework build output](/guide/built-output#vercel-build-output-api).

## `process`

Only the global `process.env` exists on this runtime. `process.env` is allowed as a whole (`Object.keys(process.env)`, `const { FOO } = process.env`), and the rest of `process` is not. An import of `node:process`, with `import process from 'node:process'` or `import { env } from 'node:process'`, is reported, because `node:process` is not one of the allowed modules.

## `require`

The documentation says calling `require` directly is not allowed and that packages must be ES modules. Vercel bundles the code, so a static `require('x')` is part of the bundle and is not reported. A `require` whose module is computed at runtime, such as `require(name)`, cannot be bundled. It is reported as an error here and stays an `unknown` warning on the other targets. A `require` inside `try` stays a warning, because the `catch` handles the error. When a `try` block guards the call and the name is a conditional expression of strings, such as `flag ? 'a' : 'b'`, edgefit reads a `require` for each string and does not report `require(<expression>)`. See [Try blocks](/guide/findings#try-blocks).

## Middleware and edge functions

edgefit's [production witness](/contributing/data#production-witness) runs on Vercel as middleware and as an edge function, and the two are not the same. edgefit has one `vercel-edge` target for both, so an API that one of them lacks is reported as missing, and the note names the one that has it.

* Edge functions have no `DOMException`, `WeakRef` or `FinalizationRegistry`. Middleware has them. A middleware that uses them gets a finding to dismiss. Next.js checks for `FinalizationRegistry` itself, so its own use of `WeakRef` is reported as guarded.
* Middleware has no `async_hooks.AsyncResource`. Edge functions have it.
* Middleware runs `WebAssembly.compile` and `WebAssembly.instantiate` with bytes. Edge functions do not, as the documentation says, so both are still reported.
* Middleware has `Float16Array`, `DisposableStack`, `AsyncDisposableStack` and `SuppressedError`. Edge functions do not, so a use of them is reported.
* Both have `AsyncLocalStorage` as a global.

## What is not checked

* **A check of a browser global.** The data has none of `window`, `document`, `HTMLAnchorElement`, `Deno` or `Bun`, and no source measures them on the edge route. So a check such as `typeof window !== 'undefined'` guards the code behind it. A read of `window`, `document` or `HTMLAnchorElement` by its plain name as the module loads is a finding.
* **A `require` that does not resolve, inside `try`.** esbuild keeps it as a call left for runtime and does not warn, so edgefit records nothing for it. Outside `try`, an unresolved `require` stops the check.
* **Vercel's limits** on bundle size and execution time.

Two limits of those member lists:

* Both files are local stand-ins for production (Next's own edge sandbox, and Vercel's dev server). The production witness confirmed their lists in middleware and in edge functions, except `async_hooks.AsyncResource`, which middleware lacks. The documentation's "fully supported" for `events` is wider than the sandbox's member list, and the list wins here, which can only cause false errors.
* Turbopack's edge build also keeps `assert/strict` and `util/types` as separate modules, but neither sandbox lists them, so they are reported as missing. The [production witness](/contributing/data#production-witness) has not looked them up yet: it imports only the five allowed modules.

## How trustworthy this is

The results describe what Vercel's documentation says, corrected where the production witness measured something else. The report notes this.

A weekly job checks the data two ways, and adds a section to the data drift issue when either finds something:

* It parses the documentation page and compares its modules, Web APIs, disabled features and a hash of each module's description with the data.
* It runs Vercel's emulator, `@edge-runtime/vm`, and compares it with the documentation. The emulator is a witness, not a source: it does not define `Buffer` or `process`, and it can compile WebAssembly from bytes, which Vercel disables. Those differences are known and listed, so only new ones are reported.

`edgefit compare` leaves `vercel-edge` out unless you name it.
