T
TanStack2y ago
optimistic-gold

How to hide the devtools in deployed apps?

I deployed an app with Tanstack router and devtools. The devtools are showing on the deployed app.
2 Replies
wee-brown
wee-brown2y ago
Did you make sure to build your app with NODE_ENV=production?
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,
// For Embedded Mode
// default: res.TanStackRouterDevtoolsPanel
})),
)
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,
// For Embedded Mode
// default: res.TanStackRouterDevtoolsPanel
})),
)
Thats from the docs, there you dont render the devtools depending on your NODE_ENV
optimistic-gold
optimistic-goldOP2y ago
ah not yet. i will. thanks. This works by the way. I am using it now. Thanks!

Did you find this page helpful?