Skip to content

Commit abfcaa8

Browse files
authored
only typegen.watch during dev (#12299)
1 parent 144a89a commit abfcaa8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/react-router-dev/vite/plugin.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,10 +747,12 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
747747
rootDirectory =
748748
viteUserConfig.root ?? process.env.REACT_ROUTER_ROOT ?? process.cwd();
749749

750-
Typegen.watch(rootDirectory, {
751-
// ignore `info` logs from typegen since they are redundant when Vite plugin logs are active
752-
logger: vite.createLogger("warn", { prefix: "[react-router]" }),
753-
});
750+
if (viteCommand === "serve") {
751+
Typegen.watch(rootDirectory, {
752+
// ignore `info` logs from typegen since they are redundant when Vite plugin logs are active
753+
logger: vite.createLogger("warn", { prefix: "[react-router]" }),
754+
});
755+
}
754756

755757
reactRouterConfigLoader = await createConfigLoader({
756758
rootDirectory,

0 commit comments

Comments
 (0)