Skip to content

Commit

Permalink
fix: should not render tanstack router devtool in production (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
KMJ-007 authored Oct 23, 2024
1 parent 7ec60e8 commit acac580
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -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: () => (
Expand Down

0 comments on commit acac580

Please sign in to comment.