@ryankshaw/next-runtime-env
Version:
Next.js Runtime Environment Configuration - Populates your environment at runtime rather than build time.
23 lines (22 loc) • 693 B
TypeScript
import { type NEXT_PUBLIC_string, type PublicEnv } from '../helpers/next-public-utils.js';
declare global {
interface Window {
__ENV: PublicEnv;
}
}
/**
* Sets the public environment variables in the browser. Forwards any other props (like `nonce`) on to the <script> tag.
*
* This component is disables Next.js' caching mechanism to ensure that the
* environment variables are always up-to-date.
*
* Usage:
* ```ts
* <head>
* <PublicEnvScript />
* </head>
* ```
*/
export declare function PublicEnvScript({ whitelist, ...otherProps }: React.ComponentProps<'script'> & {
whitelist?: NEXT_PUBLIC_string[];
}): Promise<import("react/jsx-runtime").JSX.Element>;