Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): remove duplicate application bund…
Browse files Browse the repository at this point in the history
…le generation complete message

In some scenarios in Webpack 5 percentage goes from 1 back to 0.99, ex: 0.99 -> 1 -> 0.99 -> 1. This causes the "complete" message to be displayed multiple times.
  • Loading branch information
alan-agius4 authored and clydin committed Apr 13, 2021
1 parent 1f662eb commit cc52e54
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,17 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
if (buildOptions.progress) {
const spinner = new Spinner();

let previousPercentage: number | undefined;
extraPlugins.push(new ProgressPlugin({
handler: (percentage: number, message: string) => {
if (previousPercentage === 1 && percentage !== 0) {
// In some scenarios in Webpack 5 percentage goes from 1 back to 0.99.
// Ex: 0.99 -> 1 -> 0.99 -> 1
// This causes the "complete" message to be displayed multiple times.

return;
}

switch (percentage) {
case 0:
spinner.start(`Generating ${platform} application bundles...`);
Expand All @@ -241,6 +250,8 @@ export function getCommonConfig(wco: WebpackConfigOptions): Configuration {
spinner.text = `Generating ${platform} application bundles (phase: ${message})...`;
break;
}

previousPercentage = percentage;
},
}));
}
Expand Down

0 comments on commit cc52e54

Please sign in to comment.