Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions docs/1.docs/50.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,19 @@ export default defineConfig({

```

> [!TIP]
> Nitro loads the configuration using [c12](https://github.com/unjs/c12), giving more possibilities such as using `.nitrorc` file in current working directory or in the user's home directory.
### Supported configuration files

Nitro loads its configuration using [c12](https://github.com/unjs/c12) from the project root directory (the directory passed to the `nitro` CLI, defaulting to the current working directory). The following locations are checked in order and the first matching file is used:

- `nitro.config.{js,ts,mjs,cjs,mts,cts,json,jsonc,json5,yaml,yml,toml}`
- `.config/nitro.{js,ts,mjs,cjs,mts,cts,json,jsonc,json5,yaml,yml,toml}`
- `.config/nitro.config.{js,ts,mjs,cjs,mts,cts,json,jsonc,json5,yaml,yml,toml}`

Using `nitro.config.ts` is the recommended convention.

An extensionless `.nitrorc` file in the same directory is also loaded (using `key=value` syntax) and merged with lower priority than the main configuration file.

When using the Vite plugin, options can also be passed inline with the `nitro` key in `vite.config.ts` (as shown above).

### Environment-specific config

Expand Down Expand Up @@ -73,10 +84,6 @@ export default defineConfig({
})
```

### Config from `package.json`

You can also provide Nitro configuration under the `nitro` key in your `package.json` file.

## Directory options

Nitro provides several options for controlling directory structure:
Expand Down