-
Notifications
You must be signed in to change notification settings - Fork 30.4k
fix(turbopack): --debug-build-paths fails with route groups #89336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
fix(turbopack): --debug-build-paths fails with route groups #89336
Conversation
Tests Passed |
Stats from current PR🔴 2 regressions, 1 improvement
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **434 kB** → **432 kB** ✅ -2.58 kB81 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (25 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-exp..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page.runtime.dev.jsfailed to diffapp-page.runtime.prod.jsfailed to diffapp-route-ex..ntime.dev.jsDiff too large to display app-route-ex..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route-tu..ntime.dev.jsDiff too large to display app-route-tu..time.prod.jsDiff too large to display app-route.runtime.dev.jsDiff too large to display app-route.ru..time.prod.jsDiff too large to display pages-api-tu..ntime.dev.jsDiff too large to display pages-api-tu..time.prod.jsDiff too large to display pages-api.runtime.dev.jsDiff too large to display pages-api.ru..time.prod.jsDiff too large to display pages-turbo...ntime.dev.jsDiff too large to display pages-turbo...time.prod.jsDiff too large to display pages.runtime.dev.jsDiff too large to display pages.runtime.prod.jsDiff too large to display server.runtime.prod.jsDiff too large to display |
Strip route group segments (xxx) and parallel route segments @xxx from app router paths in debug-build-paths to match AppPath format. This fixes PageNotFoundError when using --debug-build-paths with route groups like app/(dashboard)/**/page.tsx
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
eps1lon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be reviewed by Turbopack. Seems odd to me that we need one-off handling here. I would've expected that these different kind of paths are typed in Turbopack/have conversion utils.
|
These keys come from next.js/crates/next-api/src/app.rs Lines 809 to 821 in 2e3fb9b
next.js/crates/next-core/src/app_structure.rs Lines 828 to 833 in 2e3fb9b
next.js/crates/next-core/src/app_structure.rs Lines 619 to 621 in 2e3fb9b
next.js/crates/next-core/src/next_app/mod.rs Line 413 in 2e3fb9b
Maybe we can defer that |

Confirmed the fix locally on the original app I faced the issue with.
Why?
When using
--debug-build-paths, a pattern with a route group on Turbopack, it fails with an error:Current Behavior: https://github.com/vercel/next.js/actions/runs/21544427008/job/62083680496?pr=89336#step:35:459
The bug lives in
crates/next-api/src/project.rs, specifically infrom_debug_build_paths(). This function is responsible for deriving route paths from debug build inputs, but it currently preserves route groups when it shouldn’t.With the current behavior, an input like
app/(group)/nested/page.tsxproduces the output/(group)/nested. In other words, the route group segment is kept in the generated path.However, Turbopack route keys explicitly strip route groups. In
next-core/src/next_app/mod.rs, the conversion fromAppPagetoAppPathremoves route group segments. For the same input, Turbopack expects the route key to be/nested, not/(group)/nested.This mismatch causes a downstream failure.
from_debug_build_paths()produces/(group)/nested, while the Turbopack route key is/nested. Sinceshould_include_app_route()relies on an exact string match, the comparison fails. As a result, the route is excluded, the module is never compiled, and the error ultimately surfaces as aPageNotFoundError.How?
Strip route group
(xxx)and parallel route@xxxsegments infrom_debug_build_paths()to match how Turbopack normalizes route keys.