Builds errors bugfix
This commit is contained in:
+10
-1
@@ -1,6 +1,15 @@
|
||||
type Params = {
|
||||
/**
|
||||
* Also stop esbuild's service process. Only safe when no other esbuild
|
||||
* call can be in flight (e.g. before exiting, or right after the startup
|
||||
* build). The service restarts on the next esbuild call.
|
||||
*/
|
||||
stop_service?: boolean;
|
||||
};
|
||||
/**
|
||||
* 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 function disposeBundlerContexts(): Promise<void>;
|
||||
export default function disposeBundlerContexts(params?: Params): Promise<void>;
|
||||
export {};
|
||||
|
||||
+11
-1
@@ -1,9 +1,10 @@
|
||||
import * as esbuild from "esbuild";
|
||||
/**
|
||||
* 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() {
|
||||
export default async function disposeBundlerContexts(params) {
|
||||
try {
|
||||
await global.BUNEXT_BUNDLER_CTX?.dispose();
|
||||
}
|
||||
@@ -14,4 +15,13 @@ export default async function disposeBundlerContexts() {
|
||||
}
|
||||
catch (error) { }
|
||||
global.BUNEXT_SSR_BUNDLER_CTX = undefined;
|
||||
if (params?.stop_service) {
|
||||
// Exiting while the service is still running can leave it orphaned
|
||||
// with an unanswered ping, which crashes it with "all goroutines are
|
||||
// asleep - deadlock!".
|
||||
try {
|
||||
await esbuild.stop();
|
||||
}
|
||||
catch (error) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user