Title: devtools-vite: four transform hooks have no filter, and inject-plugin parses pre-bundled dependency chunks · Issue #553 · TanStack/devtools · GitHub
Open Graph Title: devtools-vite: four transform hooks have no filter, and inject-plugin parses pre-bundled dependency chunks · Issue #553 · TanStack/devtools
X Title: devtools-vite: four transform hooks have no filter, and inject-plugin parses pre-bundled dependency chunks · Issue #553 · TanStack/devtools
Description: TanStack Devtools version @tanstack/devtools-vite 0.8.5 (its src/plugin.ts is the same as main at 6fbe63f) Framework/Library version Vite 8.0.12 and 8.3.4, React 19.2 Describe the bug and the steps to reproduce it A dev server calls a tr...
Open Graph Description: TanStack Devtools version @tanstack/devtools-vite 0.8.5 (its src/plugin.ts is the same as main at 6fbe63f) Framework/Library version Vite 8.0.12 and 8.3.4, React 19.2 Describe the bug and the steps...
X Description: TanStack Devtools version @tanstack/devtools-vite 0.8.5 (its src/plugin.ts is the same as main at 6fbe63f) Framework/Library version Vite 8.0.12 and 8.3.4, React 19.2 Describe the bug and the steps...
Opengraph URL: https://github.com/TanStack/devtools/issues/553
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"devtools-vite: four transform hooks have no filter, and inject-plugin parses pre-bundled dependency chunks","articleBody":"### TanStack Devtools version\n\n`@tanstack/devtools-vite` 0.8.5 (its `src/plugin.ts` is the same as `main` at 6fbe63f)\n\n### Framework/Library version\n\nVite 8.0.12 and 8.3.4, React 19.2\n\n### Describe the bug and the steps to reproduce it\n\nA dev server calls a transform hook on every module unless the hook declares a `filter`. In `packages/devtools-vite/src/plugin.ts`, four hooks declare none: `remove-devtools-on-build`, `inject-plugin`, `connection-injection` and `runtime-bridge`. Their handlers return early for almost every module, but only after Vite has called them. `inject-plugin` first parses the module with oxc (`detectDevtoolsFile`), and keeps doing so until it finds the file that imports a devtools package. Nothing keeps it out of `node_modules`, so it also parses Vite's pre-bundled dependency chunks, which are large and which a page loads early.\n\n`inject-source` has a filter, but it still parses every `.ts` file, though these cannot contain JSX, and every file with no `\u003c` in it.\n\nTo reproduce:\n\n1. Clone the gist, run `npm install`, then `npm run check`.\n2. The script lists the hooks without a filter. It then calls each hook the way Vite would: on 271 TypeScript and TSX files (the sources that the installed `@tanstack` packages ship, standing in for an app's own files) and on the 953 files in `node_modules`. It prints the calls, the modules each hook changed, and the time.\n\nOutput on an Apple M6 with Node 24.21:\n\n```\nTransform hooks without a filter: remove-devtools-on-build, inject-plugin, connection-injection, runtime-bridge\n\nApp modules (sample-app): 271 modules\n hook filter calls changed ms\n inject-source yes 271 53 81.1\n remove-devtools-on-build no 271 1 13.1\n better-console-logs yes 32 11 19.9\n console-pipe-transform yes 268 10 2.0\n inject-plugin no 271 1 33.8\n connection-injection no 271 0 0.3\n runtime-bridge no 271 0 0.1\n total 150.2\n\nDependency modules (node_modules): 953 modules\n hook filter calls changed ms\n inject-source yes 0 0 0.0\n remove-devtools-on-build no 953 0 0.1\n better-console-logs yes 0 0 0.0\n console-pipe-transform yes 0 0 0.0\n inject-plugin no 953 1 49.9\n connection-injection no 953 2 4.2\n runtime-bridge no 953 0 0.1\n total 54.3\n```\n\nThe same on a dev server, timing each handler during the first page load (median of 10 cold starts):\n\n- `examples/react/start`, 321 modules across the client, SSR and Nitro environments: the plugin's handlers take 54 ms, and `inject-plugin` takes 39 ms of that. It is called on all 321 modules.\n- [shadcn-admin](https://github.com/satnaing/shadcn-admin) (at e16c87f) with `devtools()` and `\u003cTanStackDevtools />` added as the docs describe, 176 client modules: the handlers take 93 ms, and `inject-plugin` takes 73 ms. It parses the pre-bundled chunks before it reaches `src/routes/__root.tsx`, the 27th module. The 802 KB `react-dom` client chunk alone takes 48 ms.\n\nThe cost grows with the number of modules. In a Vite 8 build, Rolldown must call a JavaScript hook without a filter for every module; #394 reports `remove-devtools-on-build` at 46% of plugin time in a build.\n\nExpected: each hook declares a `filter` that matches the checks its handler already makes, so Vite and Rolldown skip the modules it would ignore.\n\nRelated: #397 (for #398) made each parse cheaper; this is about how many modules get parsed.\n\n### Your Minimal, Reproducible Example - (Sandbox Highly Recommended)\n\nhttps://gist.github.com/shkumbinhasani/1f68aa6ded48473e3519964a1e0d903a\n\n### Screenshots or Videos (Optional)\n\n_No response_\n\n### Do you intend to try to help solve this bug with your own PR?\n\nYes, I am also opening a PR that solves the problem along side this issue\n\n### Terms & Code of Conduct\n\n- [x] I agree to follow this project's Code of Conduct\n- [x] 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.\n","author":{"url":"https://github.com/shkumbinhasani","@type":"Person","name":"shkumbinhasani"},"datePublished":"2026-10-18T12:45:54Z","url":"https://github.com/TanStack/devtools/issues/553"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:96d663cc-7b55-8f60-902d-9dc167bb488e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADB4:219971:2A700D0:3763A8F:6AF9AD80 |
| html-safe-nonce | e8c15134c89cb80310db7d8fb4dd3e405439fbd670af05a6dc2608fcb9695df6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREI0OjIxOTk3MToyQTcwMEQwOjM3NjNBOEY6NkFGOUFEODAiLCJ2aXNpdG9yX2lkIjoiNTQ4ODgxMjA1NzIyNDU5NTIwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 8ebe23f37f06b442627d69d567b4cb0018475b1b42d4117b4903b508181c6b85 |
| hovercard-subject-tag | issue:5909661823 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/TanStack/devtools/553/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b853c5928298929a0f838a247c248831d93cd57328ee1453d5d6e7648c4f62c1/TanStack/devtools/issues/553 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b853c5928298929a0f838a247c248831d93cd57328ee1453d5d6e7648c4f62c1/TanStack/devtools/issues/553 |
| og:image:alt | TanStack Devtools version @tanstack/devtools-vite 0.8.5 (its src/plugin.ts is the same as main at 6fbe63f) Framework/Library version Vite 8.0.12 and 8.3.4, React 19.2 Describe the bug and the steps... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | shkumbinhasani |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-preview |
| go-import | github.com/TanStack/devtools git https://github.com/TanStack/devtools.git |
| octolytics-dimension-user_id | 72518640 |
| octolytics-dimension-user_login | TanStack |
| octolytics-dimension-repository_id | 1026402761 |
| octolytics-dimension-repository_nwo | TanStack/devtools |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1026402761 |
| octolytics-dimension-repository_network_root_nwo | TanStack/devtools |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width