[PR #484] [MERGED] fix: exclude private folders (_prefix) from App Router route discovery #606

Closed
opened 2026-05-06 13:09:02 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/484
Author: @NathanDrake2406
Created: 3/12/2026
Status: Merged
Merged: 3/12/2026
Merged by: @james-elicx

Base: mainHead: fix/exclude-private-folders


📝 Commits (2)

  • 707ca61 fix: exclude private folders (_prefix) from App Router route discovery
  • df325b2 chore: format app-router.ts

📊 Changes

2 files changed (+34 additions, -12 deletions)

View changed files

📝 packages/vinext/src/routing/app-router.ts (+9 -12)
📝 tests/routing.test.ts (+25 -0)

📄 Description

Summary

  • Next.js treats _-prefixed directories in app/ as private folders excluded from routing — a recommended pattern for colocating non-route files (_components, _lib, _utils)
  • vinext was only excluding @-prefixed slot directories, so app/_components/page.tsx would incorrectly create a route at /_components
  • Adds the underscore exclusion to all four App Router filesystem scan points:
    • Main page/route discovery (scanWithExtensions exclude callback)
    • Intercepting route scanner (scanForInterceptingPages)
    • Intercepting page collector (collectInterceptingPages)
    • Slot sub-page scanner already had it (line 372)

Test plan

  • Added test: excludes private folders (underscore prefix) from route discovery — verifies _components and _lib/utils are excluded while regular routes are discovered
  • CI passes (format, lint, typecheck, vitest, playwright)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/484 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 3/12/2026 **Status:** ✅ Merged **Merged:** 3/12/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/exclude-private-folders` --- ### 📝 Commits (2) - [`707ca61`](https://github.com/cloudflare/vinext/commit/707ca616a61f970630c6c4c265879061a4dd8e6b) fix: exclude private folders (_prefix) from App Router route discovery - [`df325b2`](https://github.com/cloudflare/vinext/commit/df325b21a015a229a31ac9c122955907e27753a2) chore: format app-router.ts ### 📊 Changes **2 files changed** (+34 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/routing/app-router.ts` (+9 -12) 📝 `tests/routing.test.ts` (+25 -0) </details> ### 📄 Description ## Summary - Next.js treats `_`-prefixed directories in `app/` as [private folders](https://nextjs.org/docs/app/getting-started/project-structure#private-folders) excluded from routing — a recommended pattern for colocating non-route files (`_components`, `_lib`, `_utils`) - vinext was only excluding `@`-prefixed slot directories, so `app/_components/page.tsx` would incorrectly create a route at `/_components` - Adds the underscore exclusion to all four App Router filesystem scan points: - Main page/route discovery (`scanWithExtensions` exclude callback) - Intercepting route scanner (`scanForInterceptingPages`) - Intercepting page collector (`collectInterceptingPages`) - Slot sub-page scanner already had it (line 372) ## Test plan - [x] Added test: `excludes private folders (underscore prefix) from route discovery` — verifies `_components` and `_lib/utils` are excluded while regular routes are discovered - [x] CI passes (format, lint, typecheck, vitest, playwright) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:02 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#606
No description provided.