Skip to content

Commit f9153ce

Browse files
committed
changeset: switch to patch
since we're now testing that it works with all major versions of Vite that we support
1 parent 5ead119 commit f9153ce

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

.changeset/dull-moons-share.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
---
2-
"@react-router/dev": major
2+
"@react-router/dev": patch
33
---
44

5-
Load vite env variables before reading routes.ts
5+
Load environment variables before evaluating `routes.ts`
6+
7+
For example, you can now compute your routes based on [`VITE_`-prefixed environment variables](https://vite.dev/guide/env-and-mode#env-variables):
8+
9+
```txt
10+
# .env
11+
VITE_ENV_ROUTE=my-route
12+
```
13+
14+
```ts
15+
// app/routes.ts
16+
import { type RouteConfig, route } from "@react-router/dev/routes";
17+
18+
const routes: RouteConfig = [];
19+
if (import.meta.env.VITE_ENV_ROUTE === "my-route") {
20+
routes.push(route("my-route", "routes/my-route.tsx"));
21+
}
22+
23+
export default routes;
24+
```

0 commit comments

Comments
 (0)