Skip to content

Commit

Permalink
feat(@angular-devkit/build-angular): add webpack tranformer to extrac…
Browse files Browse the repository at this point in the history
…t-i18n builder

Closes: #16679
  • Loading branch information
JeB committed Jan 27, 2020
1 parent d4f1ff8 commit 8ebd13d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/angular_devkit/build_angular/src/extract-i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -51,7 +52,11 @@ class InMemoryOutputPlugin {
}
}

export async function execute(options: ExtractI18nBuilderOptions, context: BuilderContext) {
export async function execute(
options: ExtractI18nBuilderOptions,
context: BuilderContext,
webpackConfigurationTransformer?: ExecutionTransformer<webpack.Configuration>,
) {
// Check Angular version.
assertCompatibleAngularVersion(context.workspaceRoot, context.logger);

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 8ebd13d

Please sign in to comment.