method WatchSession.teardown
WatchSession.teardown(disposeEsbuild?: boolean): Promise<Abandoned>

close minus the two teardowns a restart must not do, because it is building a replacement in the same process rather than ending.

The pre-launched Chrome is PROCESS-global: reaping it would take it from every other session here and leave the restart paying for a cold chromium.launch(). And esbuild's incremental context is kept because disposing it re-reads NOTHING — a restart reuses the same Config, so the plugin objects in the new context would be the very ones in the old. All it achieves is respawning esbuild's service child. contextKey still swaps the context out by itself when the build inputs actually change.

That holds only while the config is REUSED. restart(patch) builds a new one, so the old context belongs to a config nothing will use again — pass disposeEsbuild there, or it is orphaned with its ref still on esbuild's service child and the process can never exit.

Parameters

optional
disposeEsbuild: boolean

Return Type

Promise<Abandoned>

Usage

import { type WatchSession } from "lib/commands/test.ts";