Skip to content

Commit 8c2b852

Browse files
alan-agius4filipesilva
authored andcommitted
fix(@angular-devkit/build-angular): improve server builder output logs
(cherry picked from commit 77fec3c)
1 parent 2a68219 commit 8c2b852

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

packages/angular_devkit/build_angular/src/app-shell/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ async function _appShellBuilder(
167167
return serverResult;
168168
}
169169

170-
spinner = new Spinner().start('Generating application shell...');
170+
spinner = new Spinner();
171+
spinner.start('Generating application shell...');
171172
const result = await _renderUniversal(options, context, browserResult, serverResult);
172173
spinner.succeed('Application shell generation complete.');
173174

packages/angular_devkit/build_angular/src/server/index.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
getStatsConfig,
2929
getStylesConfig,
3030
} from '../webpack/configs';
31-
import { createWebpackLoggingCallback } from '../webpack/utils/stats';
31+
import { webpackStatsLogger } from '../webpack/utils/stats';
3232
import { Schema as ServerBuilderOptions } from './schema';
3333

3434
// If success is true, outputPath should be set.
@@ -85,34 +85,39 @@ export function execute(
8585
concatMap(({ config, i18n }) => {
8686
return runWebpack(config, context, {
8787
webpackFactory: require('webpack') as typeof webpack,
88-
logging: createWebpackLoggingCallback(!!options.verbose, context.logger),
88+
logging: (stats, config) => {
89+
if (options.verbose) {
90+
context.logger.info(stats.toString(config.stats));
91+
}
92+
},
8993
}).pipe(
9094
concatMap(async output => {
9195
const { emittedFiles = [], webpackStats } = output;
92-
if (!output.success || !i18n.shouldInline) {
93-
return output;
94-
}
95-
9696
if (!webpackStats) {
9797
throw new Error('Webpack stats build result is required.');
9898
}
9999

100-
outputPaths = ensureOutputPaths(baseOutputPath, i18n);
101-
102-
const success = await i18nInlineEmittedFiles(
103-
context,
104-
emittedFiles,
105-
i18n,
106-
baseOutputPath,
107-
Array.from(outputPaths.values()),
108-
[],
109-
// tslint:disable-next-line: no-non-null-assertion
110-
webpackStats.outputPath!,
111-
target <= ScriptTarget.ES5,
112-
options.i18nMissingTranslation,
113-
);
114-
115-
return { output, success };
100+
let success = output.success;
101+
if (success && i18n.shouldInline) {
102+
outputPaths = ensureOutputPaths(baseOutputPath, i18n);
103+
104+
success = await i18nInlineEmittedFiles(
105+
context,
106+
emittedFiles,
107+
i18n,
108+
baseOutputPath,
109+
Array.from(outputPaths.values()),
110+
[],
111+
// tslint:disable-next-line: no-non-null-assertion
112+
webpackStats.outputPath!,
113+
target <= ScriptTarget.ES5,
114+
options.i18nMissingTranslation,
115+
);
116+
}
117+
118+
webpackStatsLogger(context.logger, webpackStats, config);
119+
120+
return { ...output, success };
116121
}),
117122
);
118123
}),

0 commit comments

Comments
 (0)