nextdoctor fix
Applies the safe, auto-fixable findings from diagnose — adds onDemandEntries tuning, removes an accidentally-disabled turbopackMemoryEviction: false, etc.
$nextdoctor fix
Safety
- Always backs up your existing config first (
next.config.js.nextdoctor-backup-<timestamp>) - Shows you exactly what it's about to change before writing anything
- Refuses to run if the working tree (inside a git repo) has uncommitted changes, so the diff it makes stays easy to review in isolation — pass
--allow-dirtyto override - Pass
-yto skip the confirmation prompt (e.g. in a setup script)
How the config insertion works
Conservative, regex-based text patching rather than a full AST rewrite, specifically so diffs stay obvious and reviewable. It handles both plain const nextConfig = { configs and typed next.config.ts written as const nextConfig: NextConfig = { (the pattern create-next-appitself generates). Unusual shapes it doesn't recognize fall back to appending a block at the end of the file — always review the diff either way.