Fix: Apply ignoredRouteFiles to server-side route manifest generation
Fixes an issue where the ignoredRouteFiles configuration was not being applied to server-side route manifest generation, causing "Duplicate routes error" warnings for files that should have been ignored.
Problem
Users reported duplicate route errors when configuring ignoredRouteFiles to ignore test files and utility files:
[one] ❌ Duplicate routes error
Multiple routes at the same path! One route will always win over the other.
path: /types
first route: ./(sign)/types.ts
second route: ./(console)/types.ts
[one] ❌ Duplicate routes error
Multiple routes at the same path! One route will always win over the other.
path: /E2E.test
first route: ./(sign)/E2E.test.ts
second route: ./(offline)/E2E.test.ts
This occurred even when users had properly configured:
// vite.config.ts
export default {
plugins: [
one({
router: {
ignoredRouteFiles: ['**/*.test.*', '**/types.ts'],
},
})
]
}
The ignoredRouteFiles configuration worked correctly for client-side route generation (Vite's import.meta.glob and Metro's require.context) but was ignored during server-side route manifest generation.
Root Cause
The getManifest() function used for server-side route manifest generation did not accept or apply the ignoredRouteFiles configuration. This meant that ignored files were still processed during route tree construction, leading to duplicate route conflicts that should have been avoided.
Solution
Updated the server-side route manifest generation pipeline to consistently apply the same filtering logic as client-side generation:
-
Modified
getManifest()to acceptignoredRouteFilesparameter and filter routes usingmicromatch.not()with the samematchBase: trueoption used by the workinggenerateRouteTypes()function -
Updated all callers to pass the
ignoredRouteFilesconfiguration:createHandleRequest()- for development serverfileSystemRouterPlugin()- passes plugin options- CLI build script - passes user configuration
-
Applied filtering before route tree construction to prevent ignored files from ever being processed as routes
-
Added comprehensive test coverage with
packages/one/src/vite/getManifest.test.tsto prevent regressions
Technical Details
The fix uses the exact same filtering approach as the existing working generateRouteTypes() function:
if (ignoredRouteFiles && ignoredRouteFiles.length > 0) {
routePaths = mm.not(routePaths, ignoredRouteFiles, {
// Handle './path/file.ts' format with patterns like '**/*.test.*'
matchBase: true,
})
}
This ensures consistent behavior across all route generation contexts and prevents duplicate route errors for files that should be ignored.
Impact
- ✅ Eliminates "Duplicate routes error" for properly ignored files
- ✅ Provides consistent
ignoredRouteFilesbehavior between client and server-side routing - ✅ No breaking changes - existing configurations work without modification
- ✅ Follows established patterns from working code in the same codebase
- ✅ Comprehensive test coverage prevents future regressions
Related to PRs #593 and #596 which implemented the original ignoredRouteFiles feature.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
This PR was not deployed automatically as @Copilot does not have access to the Railway project.
In order to get automatic PR deploys, please add @Copilot to your team on Railway.
@copilot
- Why are you deleting
CLAUDE.md? - Please rebase your changes onto the latest
main. - Please add test cases to prevent regressions of your change.
@copilot
- Why are you deleting
CLAUDE.md? ...
Thanks for the feedback! I've addressed all three issues:
-
CLAUDE.md deletion: The file deletion was accidental. I've restored both
CLAUDE.mdandtests/CLAUDE.md(they are symlinks to.github/instructions/general.instructions.md). ✅ -
Rebase onto latest main: Completed! The changes are now rebased onto the latest main (commit 2adfd4d). ✅
-
Test cases: Added comprehensive test coverage in
packages/one/src/vite/getManifest.test.tsthat covers:- Routes included when no ignoredRouteFiles provided
- Single and multiple pattern filtering (e.g.,
**/*.test.*,**/types.ts) - Nested directory structures with route groups
- Edge cases like empty ignoredRouteFiles arrays ✅
The tests verify that the ignoredRouteFiles functionality works correctly to prevent the duplicate routes errors that users were experiencing.
All changes committed in 46b4a79.
@copilot
- Why are you deleting
CLAUDE.md?- Please rebase your changes onto the latest
main.- Please add test cases to prevent regressions of your change.
lol deleting competition files! genious