mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #591] [MERGED] fix: respect pageExtensions in prerender and exclude _ prefixed api files #693
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#693
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/591
Author: @james-elicx
Created: 3/19/2026
Status: ✅ Merged
Merged: 3/19/2026
Merged by: @james-elicx
Base:
main← Head:fix/page-extensions-routing-parity📝 Commits (4)
7f46900fix: respect pageExtensions in prerender and exclude _ prefixed api filesda203cdPR #591 reviewed: 1 bug found, rest LGTM0657cf5remove files7c668a8fix: pass pageExtensions to appRouter in prerender; harden afterEach cache cleanup📊 Changes
6 files changed (+184 additions, -11 deletions)
View changed files
📝
packages/vinext/src/build/report.ts(+1 -1)📝
packages/vinext/src/build/run-prerender.ts(+3 -3)📝
packages/vinext/src/cli.ts(+8 -5)📝
packages/vinext/src/routing/pages-router.ts(+6 -1)📝
tests/build-report.test.ts(+142 -1)📝
tests/page-extensions-routing.test.ts(+24 -0)📄 Description
Summary
run-prerender.ts:pagesRouter/apiRouterwere called withoutpageExtensions, so the prerender phase always scanned with default extensions (tsx,ts,jsx,js) regardless ofnext.config.js. Now passesconfig.pageExtensions.cli.ts: HoistedresolveNextConfigsonextConfig.pageExtensionsis forwarded toprintBuildReport(previously the result was discarded inline).pages-router.ts(scanApiRoutes): Added_-prefix exclude to match Next.js behaviour —pages/api/_helpers.tswas becoming a/api/_helpersroute.report.ts: TightenedprintBuildReportsignature —pageExtensionsis now required (not optional), making callers explicit.Testing
tests/page-extensions-routing.test.ts: verifies_-prefixed files inpages/api/are excluded.tests/build-report.test.ts(added in prior work): verifyprintBuildReportrespectspageExtensionsfor both App and Pages Router.Notes
With default
pageExtensions: ["tsx","ts","jsx","js"], a file likehome.spec.tsxinpages/will still become a route — same as Next.js itself. The correct user-side fix for colocation ispageExtensions: ["page.tsx"], which vinext now respects end-to-end.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.