Skip to content

Commit f6b2213

Browse files
NicolappsConvex, Inc.
authored andcommitted
Fix framework detection of TanStack Start + Vite (#42464)
Modern TanStack Start projects use Vite, so we should try to detect TanStack Start before detecting Vite. GitOrigin-RevId: eba91feef08a4206ffbe8fc9e4902e79c96b23d7
1 parent eca72d7 commit f6b2213

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

npm-packages/convex/src/cli/lib/envvars.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,27 +158,28 @@ export async function suggestedEnvVarName(ctx: Context): Promise<{
158158
};
159159
}
160160

161-
// Vite is a dependency of a lot of things; vite appearing in dependencies is not a strong indicator.
162-
const isVite = "vite" in packages;
161+
// TanStackStart currently supports VITE_FOO for browser-side envvars.
162+
const isTanStackStart =
163+
"@tanstack/start" in packages || "@tanstack/react-start" in packages;
163164

164-
if (isVite) {
165+
if (isTanStackStart) {
165166
return {
166-
detectedFramework: "Vite",
167+
detectedFramework: "TanStackStart",
167168
envVar: "VITE_CONVEX_URL",
168-
frontendDevUrl: "http://localhost:5173",
169+
frontendDevUrl: "http://localhost:3000",
169170
publicPrefix: "VITE_",
170171
};
171172
}
172173

173-
// TanStackStart currently supports VITE_FOO for browser-side envvars.
174-
const isTanStackStart =
175-
"@tanstack/start" in packages || "@tanstack/react-start" in packages;
174+
// Vite is a dependency of a lot of things; vite appearing in dependencies is not a strong indicator.
175+
const isVite = "vite" in packages;
176176

177-
if (isTanStackStart) {
177+
if (isVite) {
178178
return {
179-
detectedFramework: "TanStackStart",
179+
detectedFramework: "Vite",
180180
envVar: "VITE_CONVEX_URL",
181-
frontendDevUrl: "http://localhost:3000",
181+
frontendDevUrl: "http://localhost:5173",
182+
publicPrefix: "VITE_",
182183
};
183184
}
184185

0 commit comments

Comments
 (0)