Configurable entry file path names (routes, root, entry.client, entry.server) #13268
brettburley
started this conversation in
Proposals
Replies: 1 comment
-
Created a draft PR for a possible implementation here in #13269. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Configurable entry file path names
Summary
The standard entry file names (
root
,routes
,entry.client
,entry.server
) should be configurable via the React Router configuration, allowing projects to use custom file names and paths while maintaining the same functionality.Motivation
While the default conventions are clear and work well for new projects, we have found that with many React Router apps, it becomes cumbersome to manage all of these files for each application. For example, we have a shared
root.tsx
that is used in dozens of applications, and the contents of that file is effectively re-exporting all of the functionality from a shared package:Rather than having to manage all of these "shell" entry files, we'd like to centralize to a single implementation and point each application to that source root file.
Furthermore, this would offer a mechanism that library authors could use to provide custom implementations of the default entry files through exposing a configuration preset that points one or more of the entry files to their custom implementations.
Proposed Solution
Add configuration options to
react-router.config.ts
for specifying custom file names:Implementation Details
appDirectory
, or be an absolute path that doesn't necessarily live within theappDirectory
to support shared configurations across multiple applications.Breaking Changes
None. This is a purely additive change that maintains backward compatibility with existing projects.
Beta Was this translation helpful? Give feedback.
All reactions