From 8ebd13daa35e93a191eccda0af336a5fa94f7b77 Mon Sep 17 00:00:00 2001 From: JeB Date: Sun, 26 Jan 2020 22:15:07 +0200 Subject: [PATCH] feat(@angular-devkit/build-angular): add webpack tranformer to extract-i18n builder Closes: #16679 --- .../build_angular/src/extract-i18n/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/angular_devkit/build_angular/src/extract-i18n/index.ts b/packages/angular_devkit/build_angular/src/extract-i18n/index.ts index c3bb25a4bd52..76b2e390eb9d 100644 --- a/packages/angular_devkit/build_angular/src/extract-i18n/index.ts +++ b/packages/angular_devkit/build_angular/src/extract-i18n/index.ts @@ -22,6 +22,7 @@ import { } from '../angular-cli-files/models/webpack-configs'; import { statsErrorsToString, statsWarningsToString } from '../angular-cli-files/utilities/stats'; import { Schema as BrowserBuilderOptions } from '../browser/schema'; +import { ExecutionTransformer } from '../transforms'; import { createI18nOptions } from '../utils/i18n-options'; import { assertCompatibleAngularVersion } from '../utils/version'; import { generateBrowserWebpackConfigFromContext } from '../utils/webpack-browser-config'; @@ -51,7 +52,11 @@ class InMemoryOutputPlugin { } } -export async function execute(options: ExtractI18nBuilderOptions, context: BuilderContext) { +export async function execute( + options: ExtractI18nBuilderOptions, + context: BuilderContext, + webpackConfigurationTransformer?: ExecutionTransformer, +) { // Check Angular version. assertCompatibleAngularVersion(context.workspaceRoot, context.logger); @@ -133,7 +138,10 @@ export async function execute(options: ExtractI18nBuilderOptions, context: Build } }; - return runWebpack(config, context, { + const finalConfig = webpackConfigurationTransformer ? + await webpackConfigurationTransformer(config) : config; + + return runWebpack(finalConfig, context, { logging, webpackFactory: await import('webpack'), }).toPromise();