Skip to content

Commit ff32ada

Browse files
clydinalan-agius4
authored andcommitted
feat(@angular-devkit/build-webpack): provide output path in builder results
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.
1 parent 3bf831f commit ff32ada

File tree

2 files changed

+4
-1
lines changed
  • packages/angular_devkit/build_webpack/src

2 files changed

+4
-1
lines changed

packages/angular_devkit/build_webpack/src/webpack-dev-server/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function runWebpackDevServer(
7272
return createWebpack({ ...config, watch: false }).pipe(
7373
switchMap(webpackCompiler => new Observable<DevServerBuildOutput>(obs => {
7474
const server = createWebpackDevServer(webpackCompiler, devServerConfig);
75-
let result: DevServerBuildOutput;
75+
let result: Partial<DevServerBuildOutput>;
7676

7777
webpackCompiler.hooks.done.tap('build-webpack', (stats) => {
7878
// Log stats.
@@ -82,6 +82,7 @@ export function runWebpackDevServer(
8282
...result,
8383
emittedFiles: getEmittedFiles(stats.compilation),
8484
success: !stats.hasErrors(),
85+
outputPath: stats.compilation.outputOptions.path,
8586
} as unknown as DevServerBuildOutput);
8687
});
8788

packages/angular_devkit/build_webpack/src/webpack/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface WebpackFactory {
2626
export type BuildResult = BuilderOutput & {
2727
emittedFiles?: EmittedFiles[];
2828
webpackStats?: webpack.Stats.ToJsonOutput;
29+
outputPath: string;
2930
};
3031

3132
export function runWebpack(
@@ -77,6 +78,7 @@ export function runWebpack(
7778
success: !stats.hasErrors(),
7879
webpackStats: shouldProvideStats ? stats.toJson() : undefined,
7980
emittedFiles: getEmittedFiles(stats.compilation),
81+
outputPath: stats.compilation.outputOptions.path,
8082
} as unknown as BuildResult);
8183

8284
if (!config.watch) {

0 commit comments

Comments
 (0)