-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
routes.ts
support behind future flag (#10107)
- Loading branch information
1 parent
f7a5272
commit 2dcd85f
Showing
40 changed files
with
3,025 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
"@remix-run/dev": minor | ||
--- | ||
|
||
Add support for `routes.ts` behind `future.v3_routeConfig` flag to assist with the migration to React Router v7. | ||
|
||
Config-based routing is the new default in React Router v7, configured via the `routes.ts` file in the app directory. Support for `routes.ts` and its related APIs in Remix are designed as a migration path to help minimize the number of changes required when moving your Remix project over to React Router v7. While some new packages have been introduced within the `@remix-run` scope, these new packages only exist to keep the code in `routes.ts` as similar as possible to the equivalent code for React Router v7. | ||
|
||
When the `v3_routeConfig` future flag is enabled, Remix's built-in file system routing will be disabled and your project will opted into React Router v7's config-based routing. | ||
|
||
To enable the flag, in your `vite.config.ts` file: | ||
|
||
```ts | ||
remix({ | ||
future: { | ||
v3_routeConfig: true, | ||
}, | ||
}) | ||
``` | ||
|
||
A minimal `routes.ts` file to support Remix's built-in file system routing looks like this: | ||
|
||
```ts | ||
// app/routes.ts | ||
import { flatRoutes } from "@remix-run/fs-routes"; | ||
import type { RouteConfig } from "@remix-run/route-config"; | ||
|
||
export const routes: RouteConfig = flatRoutes(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.