From your Next.js app directory, install the loader with npm
$ npm install @dotenvx/next-env@^3.0.0
In your app’s package.json, add this entry to the overrides object so Next.js uses the Dotenvx loader.
{
"overrides": {
"@next/env": "npm:@dotenvx/next-env@^3.0.0"
}
}
Apply the override.
$ npm install
See the Next.js SDK guide for usage and API details.