Skip to content

Commit

Permalink
fix(angular): warn in ng-packagr executors when finding conflicting p…
Browse files Browse the repository at this point in the history
…ackage export conditions
  • Loading branch information
leosvelperez committed May 10, 2023
1 parent 6aac7ba commit f592338
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,20 +397,15 @@ function generatePackageExports(
subpath: string,
mapping: ConditionalExport
) => {
if (exports[subpath] === undefined) {
exports[subpath] = {};
}

exports[subpath] ??= {};
const subpathExport = exports[subpath];

// Go through all conditions that should be inserted. If the condition is already
// manually set of the subpath export, we throw an error. In general, we allow for
// additional conditions to be set. These will always precede the generated ones.
for (const conditionName of Object.keys(mapping) as [
keyof ConditionalExport
]) {
for (const conditionName of Object.keys(mapping)) {
if (subpathExport[conditionName] !== undefined) {
throw Error(
logger.warn(
`Found a conflicting export condition for "${subpath}". The "${conditionName}" ` +
`condition would be overridden by ng-packagr. Please unset it.`
);
Expand Down

0 comments on commit f592338

Please sign in to comment.