Skip to content
Source
Sign inSign up
TanStack/router

fix(start-plugin-core): release each environment's server-fn compiler after its build #8797

OpenGourav224(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8797/headopened

Showing 3 changed files with 78 additions and 0 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/release-start-compiler-after-build.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/start-plugin-core': patch
+---
+​
+Release each environment's server function compiler when its build ends, so its module cache and hook context no longer stay in memory while later environments build.
8 additions and 0 deletionspackages/start-plugin-core/src/vite/start-compiler-plugin/plugin.tsModified
View file
@@ -409,6 +409,14 @@
compilers.delete(this.environment.name)
+ buildEnd() {
+ if (this.environment.mode === 'build') {
+ // Nothing reads this environment's compiler after its build ends.
+ // Release its module cache and hook context so they do not stay
+ // alive while later environments build.
+ compilers.delete(this.environment.name)
+ }
+ },
async watchChange(id) {
if (bundledDev && this.environment.mode === 'dev') {
if (environment.type === 'server') {