Files
Luis Meyer 7b5ea9a808 Reapply OIDC (#390)
* Reapply "Add oidc support (#374)" (#389)

This reverts commit 357ca676c6.

* bump oidc package

* review

* comments
2026-06-04 16:37:03 +02:00

1.5 KiB

@vercel/prepare-flags-definitions

A build-time utility for Vercel Flags that fetches flag definitions and bundles them into a synthetic @vercel/flags-definitions package inside node_modules. This allows @vercel/flags-core to access flag definitions instantly at runtime, even when the network is unavailable.

This package is used by the Vercel CLI and other build tools. You typically do not need to install it directly.

Installation

npm i @vercel/prepare-flags-definitions

Usage

import { prepareFlagsDefinitions } from '@vercel/prepare-flags-definitions';

const result = await prepareFlagsDefinitions({
  cwd: process.cwd(),
  env: process.env,
  userAgentSuffix: 'my-build-tool/1.0.0',
});

if (result.created) {
  console.log(`Bundled definitions for ${result.entryCount} entries`);
} else {
  console.log(`No definitions created: ${result.reason}`);
}

How It Works

  1. Scans environment variables for SDK keys (matching vf_server_* or vf_client_*)
  2. Fetches flag definitions from flags.vercel.com for each key
  3. Generates an optimized JavaScript module with deduplication and lazy parsing
  4. Writes the module to node_modules/@vercel/flags-definitions/

At runtime, @vercel/flags-core imports this module as a fallback when streaming or polling is unavailable.

Documentation