Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@angular-devkit/build-angular): allow transformation of i18n extraction builder configuration #18613

Merged
merged 1 commit into from
Aug 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/angular_devkit/build_angular/src/extract-i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from '../angular-cli-files/models/webpack-configs';
import { statsErrorsToString, statsHasErrors, statsHasWarnings, 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 @@ -83,6 +84,9 @@ class InMemoryOutputPlugin {
export async function execute(
options: ExtractI18nBuilderOptions,
context: BuilderContext,
transforms?: {
webpackConfiguration?: ExecutionTransformer<webpack.Configuration>;
},
): Promise<BuildResult> {
// Check Angular version.
assertCompatibleAngularVersion(context.workspaceRoot, context.logger);
Expand Down Expand Up @@ -226,10 +230,14 @@ export async function execute(
}
};

const webpackResult = await runWebpack(config, context, {
logging,
webpackFactory: await import('webpack'),
}).toPromise();
const webpackResult = await runWebpack(
(await transforms?.webpackConfiguration?.(config)) || config,
context,
{
logging,
webpackFactory: await import('webpack'),
},
).toPromise();

// Complete if using VE
if (!usingIvy) {
Expand Down