Skip to content
Source
Sign inSign up
TanStack/router

fix(start-plugin-core): guard hotUpdate against missing this.environment #8061

OpenTIMTOMTOP(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/8061/headopened

Showing 2 changed files with 11 additions and 0 deletions.

x
0 of 2 viewed, 2 left
5 additions and 0 deletions.changeset/start-compiler-hot-update-bundled-dev.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+​
+Guard the start compiler plugin's `hotUpdate` hook against a missing `this.environment`, which crashed every hot update (and left the dev server serving stale output) when Vite's `experimental.bundledDev` passes the hook to Rolldown's dev engine.
6 additions and 0 deletionspackages/start-plugin-core/src/vite/start-compiler-plugin/plugin.tsModified
View file
@@ -396,6 +396,12 @@
​
hotUpdate(ctx) {
+ // Rolldown's dev engine (`experimental.bundledDev`) invokes this hook
+ // without an environment; invalidation then happens via `watchChange`.
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
+ if (!this.environment) {
+ return
+ }
const compiler = compilers.get(this.environment.name)
const idsToInvalidate = new Set<string>()
const transitiveCompilerImportersToInvalidate = new Set<string>()