bug(web): TanStack DevTools rendered unconditionally in RootDocument and unpinned dependencies
Platform
All / Linux / macOS / Windows
Browser
All browsers (Chrome / Firefox / Safari)
Current Behavior
<TanStackDevtools />and<TanStackRouterDevtoolsPanel />inapps/web/src/routes/__root.tsxare rendered unconditionally insideRootDocument, leaking internal devtools into production bundles.- TanStack dependencies in
apps/web/package.jsonuse unpinned"latest"versions, causing non-deterministic builds across environments.
Expected Behavior
- Devtools should only render in local development mode when
import.meta.env.DEVis true. - TanStack dependencies should be pinned with consistent semver ranges.
Proposed Fix
A verified patch is available in this fork branch:
https://github.com/iamameerhamza/OpenCut/tree/fix/web-devtools-and-deps (Commit d11c4c8)
Recurrence Probability
Always
Steps To Reproduce
- Inspect
apps/web/src/routes/__root.tsx(lines 60–70) and note that<TanStackDevtools />and<TanStackRouterDevtoolsPanel />are included directly inRootDocumentwithout an environment guard. - Run a production build (
vite build/pnpm build). - Notice internal TanStack devtools components are bundled into the production output.
- Inspect
apps/web/package.jsonand notice@tanstack/*dependencies use unpinned"latest".
Anything else?
Patch branch:
https://github.com/iamameerhamza/OpenCut/tree/fix/web-devtools-and-deps (Commit d11c4c8)
Hi, I can work on this if no PR has been opened yet. The fix seems to be guarding the TanStack devtools behind import.meta.env.DEV and pinning the @tanstack/* dependencies in apps/web/package.json.
Please let me know if you’d like me to submit a PR.
/claim
Hi, I've already implemented a fix for this on my fork: https://github.com/seuthootDev/OpenCut/tree/fix/web-devtools-and-deps
Changes:
- Guarded
<TanStackDevtools />inapps/web/src/routes/__root.tsxbehindimport.meta.env.DEV - Pinned the unpinned
@tanstack/*deps inapps/web/package.json(previously"latest") to their current released versions
Verified with a production build (vite build) that no devtools code ends up in dist/client or dist/server output.
Let me know if this is good to go and I'll open a PR.