diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx index b4a79a0..16dc731 100644 --- a/src/routes/__root.tsx +++ b/src/routes/__root.tsx @@ -1,5 +1,14 @@ import { createRootRoute, Outlet } from '@tanstack/react-router'; -import { TanStackRouterDevtools } from '@tanstack/router-devtools'; + +const TanStackRouterDevtools = + process.env.NODE_ENV === 'production' + ? () => null // Render nothing in production + : React.lazy(() => + // Lazy load in development + import('@tanstack/router-devtools').then((res) => ({ + default: res.TanStackRouterDevtools + })), + ) export const Route = createRootRoute({ component: () => (