Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/ExportsFieldPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,18 @@ module.exports = class ExportsFieldPlugin {
}

if (paths.length === 0) {
let conditions;
if (this.conditionNames.length > 1) {
const listFormat = new Intl.ListFormat("en", { type: "disjunction" });
conditions = `the conditions ${listFormat.format(this.conditionNames.map(c => `"${c}"`))}`;
} else if (this.conditionNames.length == 1) {
conditions = `the condition "${this.conditionNames[0]}"`;
} else {
conditions = "the conditions [empty]";
}
return callback(
new Error(
`Package path ${remainingRequest} is not exported from package ${request.descriptionFileRoot} (see exports field in ${request.descriptionFilePath})`,
`"${remainingRequest}" is not exported under ${conditions} from package ${request.descriptionFileRoot} (see exports field in ${request.descriptionFilePath})`,
),
);
}
Expand Down