start-compiler-plugin: hotUpdate crashes with TypeError under vite experimental.bundledDev
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript, vite
- Domain
- build-system, devtools
Research direction
Start in src/vite/start-compiler-plugin/plugin.ts and inspect the hotUpdate hook alongside watchChange. Reproduce with pnpm install && pnpm dev in the linked repro using experimental.bundledDev, then edit a source file. Done means hot updates no longer fail when the hook lacks an environment context and the dev server does not serve stale output.
Written by the indexing model from the issue text.
Description
Which project does this relate to?
Start
Describe the bug
The hotUpdate hook in @tanstack/start-plugin-core (src/vite/start-compiler-plugin/plugin.ts) reads this.environment.name unconditionally.
When Vite's experimental.bundledDev (full bundle mode) is enabled, the client environment is driven by Rolldown's dev engine. Vite passes environment plugins into that build, but injectEnvironmentToHooks only wraps hooks listed in ROLLUP_HOOKS, and hotUpdate is not in that list. Rolldown therefore invokes hotUpdate with its own PluginContextImpl as this. It has no environment property, so the hook throws TypeError: Cannot read properties of undefined (reading 'name'). On this path ctx is {type: 'update', file, modules: [null]}.
The dev server does not crash. Rolldown wraps the throw into a build error, the rebuild fails, and the dev server serves stale output on every subsequent edit until restart. Fires on 100% of hot updates.
✘ Build error: Build failed with 1 error:
[plugin tanstack-start-core::server-fn:client]
TypeError: Cannot read properties of undefined (reading 'name')
at PluginContextImpl.hotUpdate (.../start-plugin-core/dist/esm/vite/start-compiler-plugin/plugin.js:183:53)
at plugin (.../rolldown/dist/shared/bindingify-input-options-C-Zsy1EG.mjs:1734:24)
Present in 1.171.17 through latest (1.171.34).
Your Example Website or App
https://github.com/TIMTOMTOP/tanstack-hotupdate-repro
Steps to Reproduce the Bug or Issue
pnpm install && pnpm devin the repro (vite 8.2.1, onecreateServerFn,experimental: { bundledDev: true })- Open http://localhost:3000 in a browser. The bundled-dev HMR client must register. Note: Start's SSR HTML does not inject
/bundledDevClient.mjs, so the repro adds that script tag in__root.tsx. - Edit any source file.
- Build error on every edit, browser keeps stale content.
Expected behavior
An invocation without an environment context should be a no-op, not wedge the dev server. The plugin already handles bundledDev compiler invalidation via watchChange, which does get environment injection, so nothing is lost.
Platform
- OS: macOS and Linux
- vite: 8.2.1 (rolldown 1.2.2 to 1.2.4)
- @tanstack/start-plugin-core: 1.171.17 to 1.171.34
Additional context
Not specific to TanStack: nitro's hotUpdate hooks crash the same way once this one is guarded, so the systemic fix probably belongs in Vite (wrap or strip hotUpdate in injectEnvironmentToHooks). The guard is still correct defensively.
Fix in #8061.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 136
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from TanStack/router
-
information needed
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
lazyRouteComponent reload guard key collides on Safari, capping stale-deploy recovery at one per tab Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
information needed
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·