@ryankshaw/next-runtime-env
Version:
Next.js Runtime Environment Configuration - Populates your environment at runtime rather than build time.
11 lines (10 loc) • 539 B
TypeScript
import { type NEXT_PUBLIC_string } from '../helpers/next-public-utils.js';
/**
* Reads a safe environment variable (from `window.__ENV` in the browser or `process.env` on the server).
*
* @param key - The environment variable key to read. Must start with 'NEXT_PUBLIC_'
* @returns The environment variable value.
* @throws An error if the environment variable doesn't start with 'NEXT_PUBLIC_' of it is not found
* @example const API_URL = env('NEXT_PUBLIC_API_URL')
*/
export declare function env(key: NEXT_PUBLIC_string): string;