Skip to content

Commit c0933f2

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 (cherry picked from commit 0466fb7)
1 parent fa7eeb7 commit c0933f2

File tree

2 files changed

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

2 files changed

+24
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ 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+
`Tried to extract from ${projectName} with 'projectType' ${projectType}, which is not supported.` +
41+
` The 'extract-i18n' builder can only extract from applications.`,
42+
);
43+
44+
return { success: false };
45+
}
46+
3547
// Check Angular version.
3648
assertCompatibleAngularVersion(context.workspaceRoot);
3749

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ 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+
`Tried to extract from ${projectName} with 'projectType' ${projectType}, which is not supported.` +
44+
` The 'extract-i18n' builder can only extract from applications.`,
45+
);
46+
47+
return { success: false };
48+
}
49+
3850
// Check Angular version.
3951
assertCompatibleAngularVersion(context.workspaceRoot);
4052

0 commit comments

Comments
 (0)