diff --git a/packages/angular/build/src/builders/extract-i18n/builder.ts b/packages/angular/build/src/builders/extract-i18n/builder.ts index ab4397c5d505..8ade2b0a5609 100644 --- a/packages/angular/build/src/builders/extract-i18n/builder.ts +++ b/packages/angular/build/src/builders/extract-i18n/builder.ts @@ -32,6 +32,18 @@ export async function execute( return { success: false }; } + const { projectType } = (await context.getProjectMetadata(projectName)) as { + projectType?: string; + }; + if (projectType !== 'application') { + context.logger.error( + `Tried to extract from ${projectName} with 'projectType' ${projectType}, which is not supported.` + + ` The 'extract-i18n' builder can only extract from applications.`, + ); + + return { success: false }; + } + // Check Angular version. assertCompatibleAngularVersion(context.workspaceRoot); diff --git a/packages/angular_devkit/build_angular/src/builders/extract-i18n/builder.ts b/packages/angular_devkit/build_angular/src/builders/extract-i18n/builder.ts index 81edd08febf0..bb6750189a1a 100644 --- a/packages/angular_devkit/build_angular/src/builders/extract-i18n/builder.ts +++ b/packages/angular_devkit/build_angular/src/builders/extract-i18n/builder.ts @@ -35,6 +35,18 @@ export async function execute( return { success: false }; } + const { projectType } = (await context.getProjectMetadata(projectName)) as { + projectType?: string; + }; + if (projectType !== 'application') { + context.logger.error( + `Tried to extract from ${projectName} with 'projectType' ${projectType}, which is not supported.` + + ` The 'extract-i18n' builder can only extract from applications.`, + ); + + return { success: false }; + } + // Check Angular version. assertCompatibleAngularVersion(context.workspaceRoot);