diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index c42edbe7eea6..52c0b7dc9fe2 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -438,13 +438,21 @@ function shouldSkipBundle(bundle, bundleType) { } } if (requestedBundleNames.length > 0) { + // If the name ends with `something/index` we only match if the + // entry ends in something. Such as `react-dom/index` only matches + // `react-dom` but not `react-dom/server`. Everything else is fuzzy + // search. + const entryLowerCase = bundle.entry.toLowerCase() + '/index.js'; const isAskingForDifferentNames = requestedBundleNames.every( - // If the name ends with `something/index` we only match if the - // entry ends in something. Such as `react-dom/index` only matches - // `react-dom` but not `react-dom/server`. Everything else is fuzzy - // search. - requestedName => - (bundle.entry + '/index.js').indexOf(requestedName) === -1 + requestedName => { + const matchEntry = entryLowerCase.indexOf(requestedName) !== -1; + if (!bundle.name) { + return !matchEntry; + } + const matchName = + bundle.name.toLowerCase().indexOf(requestedName) !== -1; + return !matchEntry && !matchName; + } ); if (isAskingForDifferentNames) { return true;