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();