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
  • Loading branch information
JeB committed Jan 26, 2020
1 parent d4f1ff8 commit 262bb9c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 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 @@ -26,6 +26,7 @@ import { createI18nOptions } from '../utils/i18n-options';
import { assertCompatibleAngularVersion } from '../utils/version';
import { generateBrowserWebpackConfigFromContext } from '../utils/webpack-browser-config';
import { Format, Schema } from './schema';
import { ExecutionTransformer } from '../transforms';

export type ExtractI18nBuilderOptions = Schema & JsonObject;

Expand All @@ -51,7 +52,9 @@ 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 +136,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 262bb9c

Please sign in to comment.