fix(bundled-dev): bind environment in hotUpdate plugin hook - #23317
fix(bundled-dev): bind environment in hotUpdate plugin hook#23317santhiprakash wants to merge 3 commits into
Conversation
e7cb05d to
03f305a
Compare
|
Rebased onto current The conflict was mechanical:
|
Under experimental.bundledDev, plugins passed to the rolldown dev engine were not wrapped for hotUpdate, so this.environment was undefined and plugins like @tanstack/start-plugin-core threw on every HMR update. Fixes vitejs#23314
Move hotUpdate binding out of the RollupPluginHooks switch so typecheck passes; behavior is unchanged.
03f305a to
ad34a22
Compare
|
Rebased onto current |
Differential repro for
|
| SHA | branch | fails / 5 | observed failure |
|---|---|---|---|
a98c8d95 |
base / main | 4/5 | async css order with css modules expected pink, got black |
fc9227de |
PR head | 1/5 | same assertion |
The assertion also reproduces on base in isolation (playground/css/__tests__/lightningcss/lightningcss.spec.ts).
Conclusion
This is not a head-only regression. The same black vs pink failure is flaky on a98c8d95 itself. The PR branch may shift the failure rate, but the underlying CSS order instability is inherited from the current base / main. The upstream a98c8d95 CI is already red on the same async css order with css modules assertion on Node 24 (check run 96999011597), so this appears to be the same inherited flake rather than something introduced by the hotUpdate environment binding change.
No source change is being made for this issue; I’m treating it as inherited-from-main and leaving the PR branch as-is.
|
The PR has been manually labeled as likely to be created by a bot, LLM, or agent, and will be automatically closed. This may be because the PR contains LLM-generated descriptions, does not follow the PR template, is overly verbose, or does not contain any fruitful interaction, which harms the review process. Please read our AI policy for more information. If you believe this is a mistake, please reply to this comment and we will review it. |
Summary
hotUpdatehook ininjectEnvironmentToHooks, matching howresolveId/load/transformand Rollup hooks getthis.environment.this.environment.nameis available inside wrappedhotUpdate.Fixes #23314.
Context
Under
experimental.bundledDev, plugins are cloned throughinjectEnvironmentToHooksbefore being passed to the rolldown dev engine. That helper only wrapped hooks listed inROLLUP_HOOKS(plus the three special-cased transform hooks).hotUpdateis Vite-specific and was skipped, so plugins following the documented Environment API (e.g.@tanstack/start-plugin-corereadingthis.environment.name) threw on every edit and left stale output until restart.This is intentionally narrow: it only fixes the missing
this.environmentbinding. It does not overlap with #22956, which adds the broader bundled-devhotUpdateadapter.Test plan
injectEnvironmentToHooksunit test inpackages/vite/src/node/__tests__/build.spec.tstest-unit(local run blocked by missing vite build artifact in this environment; upstream CI should cover)