Fix memory leak in dev server
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Disposes the hydration and SSR esbuild contexts, releasing the incremental
|
||||
* build state esbuild keeps in memory for them. The bundlers re-create the
|
||||
* contexts on their next run.
|
||||
*/
|
||||
export default async function disposeBundlerContexts() {
|
||||
try {
|
||||
await global.BUNEXT_BUNDLER_CTX?.dispose();
|
||||
}
|
||||
catch (error) { }
|
||||
global.BUNEXT_BUNDLER_CTX = undefined;
|
||||
try {
|
||||
await global.BUNEXT_SSR_BUNDLER_CTX?.dispose();
|
||||
}
|
||||
catch (error) { }
|
||||
global.BUNEXT_SSR_BUNDLER_CTX = undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user