Skip to content

Commit 94d1aad

Browse files
committed
fix(@angular/build): resolve error with extract-i18n builder for libraries
The `extract-i18n` builder is only intended to be used with application projects. Closes #28109
1 parent bd1e0d8 commit 94d1aad

File tree

2 files changed

+22
-0
lines changed
  • packages
    • angular/build/src/builders/extract-i18n
    • angular_devkit/build_angular/src/builders/extract-i18n

2 files changed

+22
-0
lines changed

packages/angular/build/src/builders/extract-i18n/builder.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ export async function execute(
3232
return { success: false };
3333
}
3434

35+
const { projectType } = (await context.getProjectMetadata(projectName)) as {
36+
projectType?: string;
37+
};
38+
if (projectType !== 'application') {
39+
context.logger.error(
40+
`The 'extract-i18n' builder requires the project type to be an application .`,
41+
);
42+
43+
return { success: false };
44+
}
45+
3546
// Check Angular version.
3647
assertCompatibleAngularVersion(context.workspaceRoot);
3748

packages/angular_devkit/build_angular/src/builders/extract-i18n/builder.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ export async function execute(
3535
return { success: false };
3636
}
3737

38+
const { projectType } = (await context.getProjectMetadata(projectName)) as {
39+
projectType?: string;
40+
};
41+
if (projectType !== 'application') {
42+
context.logger.error(
43+
`The 'extract-i18n' builder requires the project type to be an application .`,
44+
);
45+
46+
return { success: false };
47+
}
48+
3849
// Check Angular version.
3950
assertCompatibleAngularVersion(context.workspaceRoot);
4051

0 commit comments

Comments
 (0)