Skip to content

Commit

Permalink
feat(@angular-devkit/build-webpack): provide output path in builder r…
Browse files Browse the repository at this point in the history
…esults

This change adds the output path for the Webpack build directly to the result of the builder. This removes one of the reasons for using the Webpack JSON stats object which is expensive to generate.
  • Loading branch information
clydin authored and alan-agius4 committed Mar 15, 2021
1 parent 3bf831f commit ff32ada
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function runWebpackDevServer(
return createWebpack({ ...config, watch: false }).pipe(
switchMap(webpackCompiler => new Observable<DevServerBuildOutput>(obs => {
const server = createWebpackDevServer(webpackCompiler, devServerConfig);
let result: DevServerBuildOutput;
let result: Partial<DevServerBuildOutput>;

webpackCompiler.hooks.done.tap('build-webpack', (stats) => {
// Log stats.
Expand All @@ -82,6 +82,7 @@ export function runWebpackDevServer(
...result,
emittedFiles: getEmittedFiles(stats.compilation),
success: !stats.hasErrors(),
outputPath: stats.compilation.outputOptions.path,
} as unknown as DevServerBuildOutput);
});

Expand Down
2 changes: 2 additions & 0 deletions packages/angular_devkit/build_webpack/src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface WebpackFactory {
export type BuildResult = BuilderOutput & {
emittedFiles?: EmittedFiles[];
webpackStats?: webpack.Stats.ToJsonOutput;
outputPath: string;
};

export function runWebpack(
Expand Down Expand Up @@ -77,6 +78,7 @@ export function runWebpack(
success: !stats.hasErrors(),
webpackStats: shouldProvideStats ? stats.toJson() : undefined,
emittedFiles: getEmittedFiles(stats.compilation),
outputPath: stats.compilation.outputOptions.path,
} as unknown as BuildResult);

if (!config.watch) {
Expand Down

0 comments on commit ff32ada

Please sign in to comment.