Fix memory leak in dev server
This commit is contained in:
@@ -9,6 +9,7 @@ import grabRootFilePath from "../server/web-pages/grab-root-file-path";
|
||||
import ssrVirtualFilesPlugin from "./plugins/ssr-virtual-files-plugin";
|
||||
import ssrCTXArtifactTracker from "./plugins/ssr-ctx-artifact-tracker";
|
||||
import cleanupArtifacts from "../server/cleanup-artifacts";
|
||||
import { evictDeletedModules } from "../../utils/import-fresh";
|
||||
import { writeFileSync } from "fs";
|
||||
import path from "path";
|
||||
import { log } from "../../utils/log";
|
||||
@@ -220,6 +221,10 @@ async function doSSRRebuild(params?: RebuildParams) {
|
||||
global.BUNEXT_BUILD_FAILED = false;
|
||||
|
||||
await cleanupArtifacts({ paradigm: "ssr" });
|
||||
|
||||
// esbuild has now replaced superseded outputs on disk; release the
|
||||
// ones the server already imported.
|
||||
evictDeletedModules(BUNX_CWD_MODULE_CACHE_DIR);
|
||||
} catch (error: any) {
|
||||
global.BUNEXT_SSR_BUNDLER_CTX_DISPOSED = true;
|
||||
global.BUNEXT_BUILD_FAILED = true;
|
||||
|
||||
Reference in New Issue
Block a user