Skip to content

Commit

Permalink
fix(@angular/build): resolve error with extract-i18n builder for li…
Browse files Browse the repository at this point in the history
…braries

The `extract-i18n` builder is only intended to be used with application projects.

Closes #28109
  • Loading branch information
alan-agius4 committed Jul 29, 2024
1 parent 2901659 commit 0466fb7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/angular/build/src/builders/extract-i18n/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 0466fb7

Please sign in to comment.