@huksley/next-env-dotenv
v1.0.33
Published
Simplified next-env implementation using dotenv that loads .env and .env.NODE_ENV files
Readme
next-env-dotenv
A simplified implementation of Next.js's next-env package using dotenv. This package loads environment variables from .env and .env.${process.env.NODE_ENV} files.
Features
- Loads
.envand.env.${process.env.NODE_ENV}environment files - Supports variable expansion using
dotenv-expand - Does not override existing environment variables
- Compatible with Next.js's
@next/envAPI
Installation
npm install next-env-dotenvUsing it instead of @next/env
Add to package.json:
{
...
"overrides": {
"next": {
"@next/env": "@huksley/[email protected]"
}
}
}Install NextJS again: npm i next@16
Differences from Next.js's next-env
This version loads:
If NEXT_ENV_FILE specified, will load that file instead of NODE_ENV
.env.${process.env.NEXT_ENV_FILE}- ifNEXT_ENV_FILEis specified.env.${process.env.NODE_ENV}- ifNODE_ENVis set andNEXT_ENV_FILEis not specified).env
The original Next.js implementation also loads:
.env.local.env.NODE_ENV.local- Additional environment-specific files
License
MIT
