Commit 54d1203
authored
Fix route.replace crash with --debug-build-paths (vercel#90312)
## Summary
- Fixes `route.replace is not a function` error when running `next build
--debug-build-paths` on projects with parallel routes
**Root cause:** Turbopack filters routes at the route level (e.g.,
`/parallel-test` includes all page entries), while JS route discovery
filters at the file path level (e.g., only
`app/parallel-test/page.tsx`). This causes the `appPathsManifest` to
contain entries (like `/@sidebar/page`) that `mappedAppPages` doesn't
have. The unguarded lookup at
`mappedAppPages[originalPath].replace(...)` crashes on `undefined`.
**Fix:** Added a guard to skip manifest entries that don't exist in
`mappedAppPages`.
## Test plan
- [x] Verified `next build --debug-build-paths
'app/parallel-test/**/page.tsx'` succeeds on test fixture
- [x] Verified other `--debug-build-paths` patterns still work
(multi-page, pages-only, etc.)1 parent 1fedf5b commit 54d1203
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2185 | 2185 | | |
2186 | 2186 | | |
2187 | 2187 | | |
2188 | | - | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
2189 | 2192 | | |
2190 | 2193 | | |
2191 | 2194 | | |
| |||
0 commit comments