Skip to content

Commit bc4da87

Browse files
Stabilize future.v3_routeConfig (#10242)
1 parent 435cbd1 commit bc4da87

File tree

7 files changed

+26
-17
lines changed

7 files changed

+26
-17
lines changed

Diff for: .changeset/sour-years-cover.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"@remix-run/dev": patch
33
---
44

5-
When the `future.unstable_routeConfig` flag is enabled, your route config in `app/routes.ts` is no longer defined via the `routes` export and must now be defined via the default export.
5+
Stabilize the `future.v3_routeConfig` future flag, replacing `future.unstable_routeConfig`. This enables support for `routes.ts` to assist with the migration to React Router v7.
6+
7+
Note that if you had already enabled the `future.unstable_routeConfig` flag, your route config in `app/routes.ts` is no longer defined via the `routes` export and must now be defined via the default export.
68

79
```diff
810
import { type RouteConfig } from "@remix-run/route-config";

Diff for: docs/start/future-flags.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,11 @@ You shouldn't need to make any changes to your application code for this feature
472472

473473
You may find some usage for the new [`<Link discover>`][discover-prop] API if you wish to disable eager route discovery on certain links.
474474

475-
## unstable_routeConfig
475+
## v3_routeConfig
476476

477477
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.
478478

479-
When the `unstable_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 opt back in to file system routing, this can be explicitly configured within `routes.ts` as we'll cover below.
479+
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 opt back in to file system routing, this can be explicitly configured within `routes.ts` as we'll cover below.
480480

481481
**Update your code**
482482

@@ -487,7 +487,7 @@ To migrate Remix's file system routing and route config to the equivalent setup
487487
```ts filename=vite.config.ts
488488
remix({
489489
future: {
490-
unstable_routeConfig: true,
490+
v3_routeConfig: true,
491491
},
492492
});
493493
```

Diff for: integration/helpers/vite.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const viteConfig = {
4343
export default {
4444
${await viteConfig.server(args)}
4545
plugins: [remix(${
46-
args.routeConfig ? "{ future: { unstable_routeConfig: true } }" : ""
46+
args.routeConfig ? "{ future: { v3_routeConfig: true } }" : ""
4747
})]
4848
}
4949
`;

Diff for: integration/vite-fs-routes-test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test.describe("fs-routes", () => {
2424
2525
export default defineConfig({
2626
plugins: [remix({
27-
future: { unstable_routeConfig: true },
27+
future: { v3_routeConfig: true },
2828
})],
2929
});
3030
`,
@@ -257,7 +257,7 @@ test.describe("emits warnings for route conflicts", async () => {
257257
258258
export default defineConfig({
259259
plugins: [remix({
260-
future: { unstable_routeConfig: true },
260+
future: { v3_routeConfig: true },
261261
})],
262262
});
263263
`,
@@ -331,7 +331,7 @@ test.describe("", () => {
331331
332332
export default defineConfig({
333333
plugins: [remix({
334-
future: { unstable_routeConfig: true },
334+
future: { v3_routeConfig: true },
335335
})],
336336
});
337337
`,
@@ -380,7 +380,7 @@ test.describe("pathless routes and route collisions", () => {
380380
381381
export default defineConfig({
382382
plugins: [remix({
383-
future: { unstable_routeConfig: true },
383+
future: { v3_routeConfig: true },
384384
})],
385385
});
386386
`,

Diff for: integration/vite-route-config-test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test.describe("route config", () => {
4343
4444
export default {
4545
plugins: [remix({
46-
future: { unstable_routeConfig: true },
46+
future: { v3_routeConfig: true },
4747
})]
4848
}
4949
`,
@@ -64,7 +64,7 @@ test.describe("route config", () => {
6464
6565
export default {
6666
plugins: [remix({
67-
future: { unstable_routeConfig: true },
67+
future: { v3_routeConfig: true },
6868
routes: () => {},
6969
})]
7070
}
@@ -88,7 +88,7 @@ test.describe("route config", () => {
8888
export default {
8989
${await viteConfig.server({ port })}
9090
plugins: [remix({
91-
future: { unstable_routeConfig: true },
91+
future: { v3_routeConfig: true },
9292
routes: () => {},
9393
})]
9494
}
@@ -113,7 +113,7 @@ test.describe("route config", () => {
113113
114114
export default {
115115
plugins: [remix({
116-
future: { unstable_routeConfig: true },
116+
future: { v3_routeConfig: true },
117117
})]
118118
}
119119
`,

Diff for: packages/remix-dev/__tests__/readConfig-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ describe("readConfig", () => {
3737
"entryServerFilePath": Any<String>,
3838
"future": {
3939
"unstable_optimizeDeps": false,
40-
"unstable_routeConfig": false,
4140
"v3_fetcherPersist": false,
4241
"v3_lazyRouteDiscovery": false,
4342
"v3_relativeSplatPath": false,
43+
"v3_routeConfig": false,
4444
"v3_singleFetch": false,
4545
"v3_throwAbortReason": false,
4646
},

Diff for: packages/remix-dev/config.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ interface FutureConfig {
4848
v3_fetcherPersist: boolean;
4949
v3_relativeSplatPath: boolean;
5050
v3_throwAbortReason: boolean;
51+
v3_routeConfig: boolean;
5152
v3_singleFetch: boolean;
5253
v3_lazyRouteDiscovery: boolean;
5354
unstable_optimizeDeps: boolean;
54-
unstable_routeConfig: boolean;
5555
}
5656

5757
type NodeBuiltinsPolyfillOptions = Pick<
@@ -579,7 +579,7 @@ export async function resolveConfig(
579579
root: { path: "", id: "root", file: rootRouteFile },
580580
};
581581

582-
if (appConfig.future?.unstable_routeConfig) {
582+
if (appConfig.future?.v3_routeConfig) {
583583
invariant(routesViteNodeContext);
584584
invariant(vite);
585585

@@ -719,10 +719,10 @@ export async function resolveConfig(
719719
v3_fetcherPersist: appConfig.future?.v3_fetcherPersist === true,
720720
v3_relativeSplatPath: appConfig.future?.v3_relativeSplatPath === true,
721721
v3_throwAbortReason: appConfig.future?.v3_throwAbortReason === true,
722+
v3_routeConfig: appConfig.future?.v3_routeConfig === true,
722723
v3_singleFetch: appConfig.future?.v3_singleFetch === true,
723724
v3_lazyRouteDiscovery: appConfig.future?.v3_lazyRouteDiscovery === true,
724725
unstable_optimizeDeps: appConfig.future?.unstable_optimizeDeps === true,
725-
unstable_routeConfig: appConfig.future?.unstable_routeConfig === true,
726726
};
727727

728728
if (appConfig.future) {
@@ -732,6 +732,7 @@ export async function resolveConfig(
732732
"unstable_cssSideEffectImports",
733733
"unstable_dev",
734734
"unstable_postcss",
735+
"unstable_routeConfig",
735736
"unstable_tailwind",
736737
"unstable_vanillaExtract",
737738
"v2_errorBoundary",
@@ -741,6 +742,12 @@ export async function resolveConfig(
741742
"v2_routeConvention",
742743
];
743744

745+
if ("unstable_routeConfig" in userFlags) {
746+
logger.warn(
747+
"The `unstable_routeConfig` future flag has been stabilized as `v3_routeConfig`."
748+
);
749+
}
750+
744751
if ("v2_dev" in userFlags) {
745752
if (userFlags.v2_dev === true) {
746753
deprecatedFlags.push("v2_dev");

0 commit comments

Comments
 (0)