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 angular#28109
  • Loading branch information
alan-agius4 committed Jul 26, 2024
1 parent bd1e0d8 commit 94d1aad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 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,17 @@ export async function execute(
return { success: false };
}

const { projectType } = (await context.getProjectMetadata(projectName)) as {
projectType?: string;
};
if (projectType !== 'application') {
context.logger.error(
`The 'extract-i18n' builder requires the project type to be an application .`,
);

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,17 @@ export async function execute(
return { success: false };
}

const { projectType } = (await context.getProjectMetadata(projectName)) as {
projectType?: string;
};
if (projectType !== 'application') {
context.logger.error(
`The 'extract-i18n' builder requires the project type to be an application .`,
);

return { success: false };
}

// Check Angular version.
assertCompatibleAngularVersion(context.workspaceRoot);

Expand Down

0 comments on commit 94d1aad

Please sign in to comment.