﻿# config(path: directory, convention: 'nextjs')

> Use a directory as the base for convention files

[Node](/docs/sdk/nodejs/)

```javascript
dotenvx.config(path: directory, convention: 'nextjs')
```

## Usage

This is useful when loading a workspace's env files from a monorepo root.

```javascript
// index.js
require('@dotenvx/dotenvx').config({
  path: 'apps/web',
  convention: 'nextjs'
})
```

The directory becomes the base for every file in the convention:

```text
apps/web/.env.development.local
apps/web/.env.local
apps/web/.env.development
apps/web/.env
```

Without a convention, a directory path loads the `.env` inside it:

```javascript
require('@dotenvx/dotenvx').config({
  path: 'apps/web'
})
```
