mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-19 12:34:32 +08:00
fix(@angular/build): always clear dev-server error overlay on non-error result
Now that additional result object types can be returned from the build system, the error overlay must be cleared on all non-error results. The introduction of component update results and eventual incremental results will now properly clear the error overlay after a successful build.
This commit is contained in:
parent
71b3de8364
commit
99192a791b
@ -187,20 +187,31 @@ export async function* serveWithVite(
|
|||||||
|
|
||||||
// TODO: Switch this to an architect schedule call when infrastructure settings are supported
|
// TODO: Switch this to an architect schedule call when infrastructure settings are supported
|
||||||
for await (const result of builderAction(browserOptions, context, extensions?.buildPlugins)) {
|
for await (const result of builderAction(browserOptions, context, extensions?.buildPlugins)) {
|
||||||
|
if (result.kind === ResultKind.Failure) {
|
||||||
|
if (result.errors.length && server) {
|
||||||
|
hadError = true;
|
||||||
|
server.ws.send({
|
||||||
|
type: 'error',
|
||||||
|
err: {
|
||||||
|
message: result.errors[0].text,
|
||||||
|
stack: '',
|
||||||
|
loc: result.errors[0].location ?? undefined,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// Clear existing error overlay on successful result
|
||||||
|
if (hadError && server) {
|
||||||
|
hadError = false;
|
||||||
|
// Send an empty update to clear the error overlay
|
||||||
|
server.ws.send({
|
||||||
|
'type': 'update',
|
||||||
|
updates: [],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
switch (result.kind) {
|
switch (result.kind) {
|
||||||
case ResultKind.Failure:
|
|
||||||
if (result.errors.length && server) {
|
|
||||||
hadError = true;
|
|
||||||
server.ws.send({
|
|
||||||
type: 'error',
|
|
||||||
err: {
|
|
||||||
message: result.errors[0].text,
|
|
||||||
stack: '',
|
|
||||||
loc: result.errors[0].location ?? undefined,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
case ResultKind.Full:
|
case ResultKind.Full:
|
||||||
if (result.detail?.['htmlIndexPath']) {
|
if (result.detail?.['htmlIndexPath']) {
|
||||||
htmlIndexPath = result.detail['htmlIndexPath'] as string;
|
htmlIndexPath = result.detail['htmlIndexPath'] as string;
|
||||||
@ -253,16 +264,6 @@ export async function* serveWithVite(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear existing error overlay on successful result
|
|
||||||
if (hadError && server) {
|
|
||||||
hadError = false;
|
|
||||||
// Send an empty update to clear the error overlay
|
|
||||||
server.ws.send({
|
|
||||||
'type': 'update',
|
|
||||||
updates: [],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// To avoid disconnecting the array objects from the option, these arrays need to be mutated instead of replaced.
|
// To avoid disconnecting the array objects from the option, these arrays need to be mutated instead of replaced.
|
||||||
let requiresServerRestart = false;
|
let requiresServerRestart = false;
|
||||||
if (result.detail?.['externalMetadata']) {
|
if (result.detail?.['externalMetadata']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user