You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-zero runtime overhead in production build #112
After creating a production build, I can see a non-zero overhead from the devtools library and its plugins:
Since the devtools are available in development mode only, this overhead should not exist in the production build.
Actually, all devtools components add this overhead, not only TanStack Devtools, so let me know if I should create separate issues in the other libraries.
A workaround is to render the devtools components conditionally depending on the environment variable:
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
I agree to follow this project's Code of Conduct
I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Hi, just from my perspective, this minimal footprint is basically just export of empty function. (not noticeable by most of the apps)
As you suggested to completely remove it from the bundle, some adjustments should be done on application side, but this could be rather some part of documentation as from lib perspective it is probably hard to reduce it more. For reference this is the index file https://github.com/TanStack/devtools/blob/main/packages/react-devtools/src/index.ts
Tbh I'm not sure if this can be easily done outside the bundler, I do have some ideas I want to explore like moving the logic to vite instead of the actual libs, tree-shaking it completely out and not using it at all indeed would require something like this on the user-side.
After updating to the latest versions of devtools-related packages, Sonda highlights the following issue on build:
[plugin @tanstack/devtools:remove-devtools-on-build] Sourcemap is likely to be incorrect: a plugin (@tanstack/devtools:remove-devtools-on-build) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help
@vasilii-kovalev no, it's a bug in start, if you try it with the latest alpha it goes away, although there are a few warnings in the latest alpha that are improvements that need to be made on my side which I'm actively working on
Activity
sprusak commentedon Sep 8, 2025
Hi, just from my perspective, this minimal footprint is basically just export of empty function. (not noticeable by most of the apps)
As you suggested to completely remove it from the bundle, some adjustments should be done on application side, but this could be rather some part of documentation as from lib perspective it is probably hard to reduce it more. For reference this is the index file https://github.com/TanStack/devtools/blob/main/packages/react-devtools/src/index.ts
vasilii-kovalev commentedon Sep 8, 2025
@sprusak, thank you for the clarification!
In your opinion, does it make sense to mention the workaround in the documentation?
AlemTuzlak commentedon Sep 8, 2025
Tbh I'm not sure if this can be easily done outside the bundler, I do have some ideas I want to explore like moving the logic to vite instead of the actual libs, tree-shaking it completely out and not using it at all indeed would require something like this on the user-side.
feat: remove devtools from build bundles (#136)
vasilii-kovalev commentedon Sep 18, 2025
After updating to the latest versions of devtools-related packages, Sonda highlights the following issue on build:
main.tsx:vite.config.ts:The same with Solid setup.
It didn't happen before the update.
Repository for reproduction.
Is it a bug on devtools packages' side?
AlemTuzlak commentedon Sep 18, 2025
@vasilii-kovalev no, it's a bug in start, if you try it with the latest alpha it goes away, although there are a few warnings in the latest alpha that are improvements that need to be made on my side which I'm actively working on
AlemTuzlak commentedon Sep 19, 2025
@vasilii-kovalev this PR will bring true 0 production overhead and issues:
https://github.com/TanStack/devtools/pull/148/files
vasilii-kovalev commentedon Sep 19, 2025
Sadly, still seeing the warning, and having broken sourcemaps after updating to the latest version after the fix.
AlemTuzlak commentedon Sep 19, 2025
interesting, sourcemaps are generated by babel, not sure why it reports them as broken, i'll try to figure it out
AlemTuzlak commentedon Sep 19, 2025
okay figured it out, will release a fix in next minor
vasilii-kovalev commentedon Sep 19, 2025
After the latest update, devtools are indeed removed from production build, and the sourcemaps are correct. Thank you for your perseverance!