Skip to content

Commit d424be6

Browse files
fix(dev): add Vite 7 support (#13748)
1 parent 259c145 commit d424be6

File tree

25 files changed

+726
-19
lines changed

25 files changed

+726
-19
lines changed

.changeset/dull-pianos-matter.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-router/dev": patch
3+
---
4+
5+
Add Vite 7 support
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
3+
/.cache
4+
/build
5+
.env
6+
.react-router
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router";
2+
3+
export default function App() {
4+
return (
5+
<html lang="en">
6+
<head>
7+
<meta charSet="utf-8" />
8+
<meta name="viewport" content="width=device-width, initial-scale=1" />
9+
<Meta />
10+
<Links />
11+
</head>
12+
<body>
13+
<Outlet />
14+
<ScrollRestoration />
15+
<Scripts />
16+
</body>
17+
</html>
18+
);
19+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { type RouteConfig } from "@react-router/dev/routes";
2+
import { flatRoutes } from "@react-router/fs-routes";
3+
4+
export default flatRoutes() satisfies RouteConfig;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { MetaFunction } from "react-router";
2+
3+
export const meta: MetaFunction = () => {
4+
return [
5+
{ title: "New React Router App" },
6+
{ name: "description", content: "Welcome to React Router!" },
7+
];
8+
};
9+
10+
export default function Index() {
11+
return (
12+
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
13+
<h1>Welcome to React Router</h1>
14+
</div>
15+
);
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference types="@react-router/node" />
2+
/// <reference types="vite/client" />
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "integration-vite-7-beta-template",
3+
"version": "0.0.0",
4+
"private": true,
5+
"sideEffects": false,
6+
"type": "module",
7+
"scripts": {
8+
"dev": "react-router dev",
9+
"build": "react-router build",
10+
"start": "react-router-serve ./build/server/index.js",
11+
"typecheck": "react-router typegen && tsc"
12+
},
13+
"dependencies": {
14+
"@react-router/express": "workspace:*",
15+
"@react-router/node": "workspace:*",
16+
"@react-router/serve": "workspace:*",
17+
"@vanilla-extract/css": "^1.10.0",
18+
"@vanilla-extract/vite-plugin": "^3.9.2",
19+
"express": "^4.19.2",
20+
"isbot": "^5.1.11",
21+
"react": "^19.1.0",
22+
"react-dom": "^19.1.0",
23+
"react-router": "workspace:*",
24+
"serialize-javascript": "^6.0.1"
25+
},
26+
"devDependencies": {
27+
"@react-router/dev": "workspace:*",
28+
"@react-router/fs-routes": "workspace:*",
29+
"@react-router/remix-routes-option-adapter": "workspace:*",
30+
"@types/react": "^18.2.20",
31+
"@types/react-dom": "^18.2.7",
32+
"eslint": "^8.38.0",
33+
"typescript": "^5.1.6",
34+
"vite": "7.0.0-beta.0",
35+
"vite-env-only": "^3.0.1",
36+
"vite-tsconfig-paths": "^4.2.1"
37+
},
38+
"engines": {
39+
"node": ">=20.0.0"
40+
}
41+
}
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"include": ["env.d.ts", "**/*.ts", "**/*.tsx", ".react-router/types/**/*"],
3+
"compilerOptions": {
4+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
5+
"verbatimModuleSyntax": true,
6+
"esModuleInterop": true,
7+
"jsx": "react-jsx",
8+
"module": "ESNext",
9+
"moduleResolution": "Bundler",
10+
"resolveJsonModule": true,
11+
"target": "ES2022",
12+
"strict": true,
13+
"allowJs": true,
14+
"skipLibCheck": true,
15+
"baseUrl": ".",
16+
"paths": {
17+
"~/*": ["./app/*"]
18+
},
19+
"noEmit": true,
20+
"rootDirs": [".", ".react-router/types/"]
21+
}
22+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { reactRouter } from "@react-router/dev/vite";
2+
import { defineConfig } from "vite";
3+
import tsconfigPaths from "vite-tsconfig-paths";
4+
5+
export default defineConfig({
6+
// @ts-expect-error `dev` depends on Vite 6, Plugin type is mismatched.
7+
plugins: [reactRouter(), tsconfigPaths()],
8+
});

0 commit comments

Comments
 (0)