Skip to content

Commit 80170a0

Browse files
authored
Match bundle.name and match upper case entry points (#24346)
Fix matching in the build script. It's possible to provide a custom bundle name in the case we build deep imports. We should match those names as a convenience. The script also calls toLowerCase on requested names but some entries have upper case now.
1 parent fea6f8d commit 80170a0

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

scripts/rollup/build.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,21 @@ function shouldSkipBundle(bundle, bundleType) {
438438
}
439439
}
440440
if (requestedBundleNames.length > 0) {
441+
// If the name ends with `something/index` we only match if the
442+
// entry ends in something. Such as `react-dom/index` only matches
443+
// `react-dom` but not `react-dom/server`. Everything else is fuzzy
444+
// search.
445+
const entryLowerCase = bundle.entry.toLowerCase() + '/index.js';
441446
const isAskingForDifferentNames = requestedBundleNames.every(
442-
// If the name ends with `something/index` we only match if the
443-
// entry ends in something. Such as `react-dom/index` only matches
444-
// `react-dom` but not `react-dom/server`. Everything else is fuzzy
445-
// search.
446-
requestedName =>
447-
(bundle.entry + '/index.js').indexOf(requestedName) === -1
447+
requestedName => {
448+
const matchEntry = entryLowerCase.indexOf(requestedName) !== -1;
449+
if (!bundle.name) {
450+
return !matchEntry;
451+
}
452+
const matchName =
453+
bundle.name.toLowerCase().indexOf(requestedName) !== -1;
454+
return !matchEntry && !matchName;
455+
}
448456
);
449457
if (isAskingForDifferentNames) {
450458
return true;

0 commit comments

Comments
 (0)