Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

TanStack Start: hotUpdate crashes on every file edit under vite experimental.bundledDev

@tanstack/start-plugin-core's tanstack-start-core::server-fn:client plugin crashes on every hot update when vite's bundled dev mode (full bundle mode) is enabled. The hotUpdate hook reads this.environment.name, but rolldown's dev engine invokes the hook with its own PluginContextImpl, which has no environment. Rolldown swallows the TypeError into a build error, the rebuild fails, and the dev server keeps serving stale output.

Repro

pnpm install
pnpm dev
# open http://localhost:3000 in a browser (required: the HMR client must connect)
# edit src/routes/index.tsx (e.g. change the string in the server function)

Expected

Hot update is applied (or at worst a full reload).

Actual

The dev server prints, on every edit:

✘ 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 (.../@tanstack/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)
    at plugin.<computed> (.../rolldown/dist/shared/bindingify-input-options-C-Zsy1EG.mjs:2125:18)

The browser keeps showing the old content. Deterministic: fires on every edit.

Root cause

  • experimental.bundledDev drives the client environment with rolldown's dev engine (BundledDev in vite). Environment plugins, including tanstack-start-core::server-fn:client, are passed into that raw rolldown build.
  • Rolldown's dev engine invokes the hotUpdate hook (bindingify-watch-hooks.ts, bindingifyHotUpdate) with rolldown's PluginContextImpl as this. Unlike Vite's environment-aware plugin context, it has no environment property, and ctx.modules is [null].
  • hotUpdate in start-compiler-plugin/plugin.ts starts with compilers.get(this.environment.name) → TypeError.

Notes

  • src/routes/__root.tsx injects /bundledDevClient.mjs manually because TanStack Start's SSR HTML does not inject vite's bundled-dev HMR client. Without a registered HMR client the rolldown dev engine computes no updates, so the crash needs a real browser tab open.
  • The server function in src/routes/index.tsx is what activates the server-fn compiler plugin.

Versions

package version
vite 8.2.1
rolldown (via vite) 1.2.4
@tanstack/react-start 1.168.44
@tanstack/start-plugin-core 1.171.34
@tanstack/react-router 1.170.27

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages