A tool for creating a statically accessible copy of process.env
variables.
npm install @sadbox/env-snapshot
yarn add @sadbox/env-snapshot
import { takeEnvSnapshot } from '@sadbox/env-snapshot';
const env = takeEnvSnapshot();
env.NODE_ENV; // production
env.nodeEnv; // production
It uses dotenv
lib under the hood, so next is valid.
#.env
CUSTOM_OPTION=value
const env = takeEnvSnapshot();
env.CUSTOM_OPTION; // value
env.customOption; // value