diff --git a/docs/1.docs/50.configuration.md b/docs/1.docs/50.configuration.md index 2e312a0558..cdd0e65f39 100644 --- a/docs/1.docs/50.configuration.md +++ b/docs/1.docs/50.configuration.md @@ -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 @@ -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: