Conversation
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. WalkthroughThe Vite build plugin now preserves cached roots during watch rebuilds. For non-watch builds, Priority: ⬆️ High Severity of issue fixed: High 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
d9541bd to
ff8a6f6
Compare
Summary
The build plugin's
Rootcaches a compiler for as long as the plugin instance lives, but that compiler holds onto thePluginContextfrom thetransformcall that first created it, through theonDependencycallback passed tocompile(). Nothing ever released that captured context. In a plainvite buildthis never shows up because the process exits right after, but if the same plugin instance is reused afterward (Astro's static build runs the SSR/prerender build and then generates every page in the same process) the finished build's context, and the native Rolldown arena behind it, stay alive while the next phase starts allocating on top of it.This clears the cached roots for an environment as soon as its bundle closes, so the reference is dropped before anything else gets a chance to run.
Fixes #20501
Test plan
Added a test that wraps the build plugin's
transformhandler to grab aWeakRefon thePluginContextfrom the first call, runs a Vite 8 (Rolldown) build, forces a few GCs, and checks the context was collected. It fails on the old code and passes with the fix (only reproduces under Rolldown, not Rollup). Ran the fullintegrations/vitesuite locally and it passes.