fix(angular): warn in ng-packagr executors when finding conflicting package export conditions (#16905)
This commit is contained in:
parent
6aac7ba04b
commit
bdfb10db0a
@ -397,20 +397,15 @@ function generatePackageExports(
|
|||||||
subpath: string,
|
subpath: string,
|
||||||
mapping: ConditionalExport
|
mapping: ConditionalExport
|
||||||
) => {
|
) => {
|
||||||
if (exports[subpath] === undefined) {
|
exports[subpath] ??= {};
|
||||||
exports[subpath] = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
const subpathExport = exports[subpath];
|
const subpathExport = exports[subpath];
|
||||||
|
|
||||||
// Go through all conditions that should be inserted. If the condition is already
|
// 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
|
// 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.
|
// additional conditions to be set. These will always precede the generated ones.
|
||||||
for (const conditionName of Object.keys(mapping) as [
|
for (const conditionName of Object.keys(mapping)) {
|
||||||
keyof ConditionalExport
|
|
||||||
]) {
|
|
||||||
if (subpathExport[conditionName] !== undefined) {
|
if (subpathExport[conditionName] !== undefined) {
|
||||||
throw Error(
|
logger.warn(
|
||||||
`Found a conflicting export condition for "${subpath}". The "${conditionName}" ` +
|
`Found a conflicting export condition for "${subpath}". The "${conditionName}" ` +
|
||||||
`condition would be overridden by ng-packagr. Please unset it.`
|
`condition would be overridden by ng-packagr. Please unset it.`
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user