Add fs-routes and Remix adapter package #11971
Merged
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.
This PR makes FS routing a more first class part of React Router 7 and not just a Remix backwards compatibility layer. To achieve this,
@react-router/remix-v2-routes
has been split into two packages:@react-router/fs-routes
@react-router/remix-config-routes-adapter
fs-routes
In this PR, this package exports a
flatRoutes
function — deliberately leaving room for anestedRoutes
function in the future.For most consumers, whether coming from Remix or starting fresh with React Router, the setup will look like this:
The
rootDirectory
andignoredRouteFiles
are also supported here, but notably theroutes
option from Remix has now been moved out.remix-config-routes-adapter
This package only exists to provide a backwards compatibility layer for Remix's
routes
option, ensuring that anyone using this option has a much smoother migration process. This is particularly useful if they're using an alternative file system routing implementation that they don't control, like remix-flat-routes:Note that since this package has been split from
fs-routes
, you no longer need to setignoredRouteFiles: ['**/*']
as seen in the remix-flat-routes readme 🥳