Name the correct winning route in prerender duplicate-pathname warnings - #17833
Merged
Conversation
…rnings Change `builtPaths` from `Set<string>` to `Map<string, RouteData>` so that conflict warnings reference the route that actually first rendered the duplicate pathname, instead of using `matchRoute()` which could return an unrelated route that merely matches the URL pattern.
1 task
🦋 Changeset detectedLatest commit: 812ffb0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 423 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
e18e dependency analysisNo dependency warnings found. |
matthewp
approved these changes
Aug 27, 2026
matthewp
force-pushed
the
factory/fix-17832
branch
from
August 27, 2026 20:32
4d5470b to
7e4d5ff
Compare
matthewp
force-pushed
the
factory/fix-17832
branch
from
August 27, 2026 20:36
7e4d5ff to
7267269
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
matchRoute(), which returns the first route whose URL pattern matches the path rather than the route that emitted it, so the "winning" route in the message could be unrelated.builtPathsfromSet<string>toMap<string, RouteData>inpackages/astro/src/core/build/generate.ts. The map records which route first claimed each normalized pathname, and duplicate detection reads the winning route from the map instead of guessing via pattern matching.prerenderConflictBehavior: 'error') instead of passing through silently.Testing
prerender-conflict-same-routefixture and two cases inpackages/astro/test/prerender-conflict.test.tscovering the same-route duplicate scenario: one asserts the warning names the correct winning route, one asserts the build throws with the correct message underprerenderConflictBehavior: 'error'.Docs
Closes #17832