Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): keep esbuild server active until …
Browse files Browse the repository at this point in the history
…builder fully stops

Use the now working builder teardown functionality to ensure that the development server
is properly closed when the builder is stopped.
  • Loading branch information
clydin authored and angular-robot[bot] committed Apr 5, 2023
1 parent 4887138 commit 4822b3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/angular_devkit/build_angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ LARGE_SPECS = {
],
},
"browser-esbuild": {
"shards": 10,
"extra_deps": [
"@npm//buffer",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ export async function* serveWithVite(
yield { success: true, port: listeningAddress?.port } as unknown as DevServerBuilderOutput;
}

await server?.close();
if (server) {
let deferred: () => void;
context.addTeardown(async () => {
await server?.close();
deferred?.();
});
await new Promise<void>((resolve) => (deferred = resolve));
}
}

async function setupServer(
Expand Down

0 comments on commit 4822b3b

Please sign in to comment.