Skip to content

Commit

Permalink
getPeerGlobals should check bundleType instead of moduleType (faceboo…
Browse files Browse the repository at this point in the history
  • Loading branch information
webyom authored and gaearon committed May 17, 2018
1 parent b245795 commit 1a0afed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions scripts/rollup/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,7 @@ async function createBundle(bundle, bundleType) {

const shouldBundleDependencies =
bundleType === UMD_DEV || bundleType === UMD_PROD;
const peerGlobals = Modules.getPeerGlobals(
bundle.externals,
bundle.moduleType
);
const peerGlobals = Modules.getPeerGlobals(bundle.externals, bundleType);
let externals = Object.keys(peerGlobals);
if (!shouldBundleDependencies) {
const deps = Modules.getDependencies(bundleType, bundle.entry);
Expand Down
4 changes: 2 additions & 2 deletions scripts/rollup/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ const knownGlobals = Object.freeze({
});

// Given ['react'] in bundle externals, returns { 'react': 'React' }.
function getPeerGlobals(externals, moduleType) {
function getPeerGlobals(externals, bundleType) {
const peerGlobals = {};
externals.forEach(name => {
if (
!knownGlobals[name] &&
(moduleType === UMD_DEV || moduleType === UMD_PROD)
(bundleType === UMD_DEV || bundleType === UMD_PROD)
) {
throw new Error('Cannot build UMD without a global name for: ' + name);
}
Expand Down

0 comments on commit 1a0afed

Please sign in to comment.