From 72a20c3f379e0402884225fd77663bc7218fdfc2 Mon Sep 17 00:00:00 2001 From: Mark Dalgleish Date: Thu, 26 Sep 2024 15:03:47 +1000 Subject: [PATCH] Fix vite-node resolution within TS plugin --- packages/react-router-dev/typescript/typegen.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/react-router-dev/typescript/typegen.ts b/packages/react-router-dev/typescript/typegen.ts index 927b219a5f..4d6b1f5c34 100644 --- a/packages/react-router-dev/typescript/typegen.ts +++ b/packages/react-router-dev/typescript/typegen.ts @@ -34,7 +34,9 @@ export async function watch(ctx: Context) { const appDirectory = Path.normalize(ctx.appDirectory); const routesTsPath = Path.join(appDirectory, "routes.ts"); - const routesViteNodeContext = await ViteNode.createContext(); + const routesViteNodeContext = await ViteNode.createContext({ + root: ctx.rootDirectory, + }); async function getRoutes(): Promise { routesViteNodeContext.devServer.moduleGraph.invalidateAll(); routesViteNodeContext.runner.moduleCache.clear();