Environment
getEnv
Read one environment variable — MANIC_PUBLIC_* only in the browser; full process.env on server/Bun.
getEnv(key)
import { getEnv } from 'manicjs/env';Signature
function getEnv(key: string): string | undefined;Browser behavior
- Only keys prefixed with
MANIC_PUBLIC_return a value (fromwindow.__MANIC_ENV__injected at build time). - Other keys log a console warning and return
undefined.
Server behavior
When window is undefined, getEnv reads process.env[key] — no prefix restriction.
Parameters
Prop
Type