next.js
4023e48d - Make `--debug-build-paths` work with `src/` directory projects (#94016)

Commit
81 days ago
Make `--debug-build-paths` work with `src/` directory projects (#94016) The `--debug-build-paths` option silently dropped routes in projects that keep their `app` or `pages` directory under `src/`. When a user passed `src/app/foo/page.tsx`, the glob matched the file but `categorizeAndAddPath` only recognized paths starting with `app/` or `pages/`, so nothing was added to the resolved app paths and the build produced no user routes. Conversely, when a user passed the bare `app/foo/page.tsx` form against a `src/app` project, glob found nothing and emitted `did not match any files`. `resolveBuildPaths` now detects whether `src/app` or `src/pages` exists and prepends `src/` to bare patterns before globbing, and `categorizeAndAddPath` strips a leading `src/` from matched files so route keys are normalized either way. Added a `src-dir` fixture and four tests covering explicit `src/` prefixes, bare patterns with auto-prefixing, and glob patterns through route groups.
Author
Parents
Loading