docs: list supported configuration file names - #4517
Conversation
Document the exact configuration files Nitro loads via c12: nitro.config.* (12 extensions), .config/nitro.* and .config/nitro.config.*, plus the extensionless .nitrorc file. Also remove two inaccurate claims: configuration via the package.json nitro key and a .nitrorc in the user home directory are not loaded (c12 packageJson/globalRc options are not enabled by Nitro). Closes nitrojs#4505
|
@tarikermis is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe configuration documentation now lists supported Nitro configuration filenames, lookup order, project-root resolution, ChangesConfiguration documentation
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/1.docs/50.configuration.md`:
- Around line 41-45: Update the configuration file lists in the Nitro
configuration documentation to reflect c12’s actual extension precedence,
placing JavaScript extensions before TypeScript extensions. Apply the same
ordering consistently to all three locations: nitro.config, .config/nitro, and
.config/nitro.config.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e4397044-9b7b-49a4-bfdd-2009d3845724
📒 Files selected for processing (1)
docs/1.docs/50.configuration.md
c12 resolves .js before .ts for the same basename, so list the extensions in the order they are actually checked. Refs nitrojs#4505
🔗 Linked issue
Closes #4505
❓ Type of change
📚 Description
What: adds a "Supported configuration files" section to the Configuration docs page listing exactly which config files Nitro loads, and removes two documented claims that do not hold.
Why: as reported in #4505, the docs never stated which configuration file names are supported, making it impossible to tell whether e.g.
.nitrorc.js,nitro.config.yaml, or.config/nitro.tomlwork.Every listed filename/location was verified two ways:
loadConfig/watchConfigwithname: "nitro",cwd= therootDiroverride, i.e. the CLIdirargument defaulting to the current working directory —src/config/loader.ts,src/cli/commands/build.ts). c12 (4.0.0-beta.5,resolveConfiginnode_modules/c12/dist/index.mjs:324) resolvesnitro.config→.config/nitro→.config/nitro.config(first match wins) with extensions.js/.ts/.mjs/.cjs/.mts/.cts/.json/.jsonc/.json5/.yaml/.yml/.toml, and always reads an extensionless.nitrorc(rc9key=valuesyntax) from the same directory, merged with lower priority than the main file.loadOptions()against temp directories containing each candidate file:nitro.config.{ts,js,mjs,cjs,mts,cts,json,jsonc,json5,yaml,yml,toml},.config/nitro.*,.config/nitro.config.*(same extensions),.nitrorc.nitrorc.{json,js,yaml},.config/.nitrorc,package.jsonnitrokey,~/.nitrorcnitro.config.*>.config/nitro.*>.config/nitro.config.*; main config file >.nitrorcRemoved claims (both verified non-functional, not just undocumented):
package.json" — c12 only loads thepackage.jsonkey when itspackageJsonoption is enabled, and Nitro never enables it (also true for Nitro v2's loader with c12 v2/v3, so this is a docs inaccuracy rather than a v3 regression)..nitrorc"in the user's home directory" — c12 only reads rc files outside the cwd when itsglobalRcoption is enabled, which Nitro also never sets.Note for maintainers (out of scope here):
getConfinsrc/config/loader.ts:101still readsrawConfigs.packageJson, which can never be populated — worth either enablingpackageJson: trueor dropping that read as a follow-up.Checks run:
pnpm lint(oxlint + oxfmt) ✅; docspnpm build(undocs/Nuxt, 359 routes prerendered) ✅ with the new section present in the built output; empirical config-loading probe as described above ✅. Docs-only change, so no unit tests apply. The diff was reviewed by claude-opus-5 via kiro-cli (read-only); its findings (order-claim phrasing, rc directory precision, Vite inline-config mention) are incorporated.Limitations: verified on Linux/Node 22 against
main@ 52abde8; I did not test Windows path handling. The extension-level priority within one basename (c12 checks.jsbefore.ts) is intentionally left undocumented as an edge case.📝 Checklist