@samitouri / QOS-React / commits / 1a0afed771

getPeerGlobals should check bundleType instead of moduleType (#12839)

Gary Wang committed May 18, 2018 at 00:16 UTC 1a0afed771228667f26e74430f5d5825c06bc42d
2 files changed +3 -6
scripts/rollup/build.js
+1 -4
@@ -352,10 +352,7 @@ async function createBundle(bundle, bundleType) {
352
353 const shouldBundleDependencies =
354 bundleType === UMD_DEV || bundleType === UMD_PROD;
355 - const peerGlobals = Modules.getPeerGlobals(
356 - bundle.externals,
357 - bundle.moduleType
358 - );
355 + const peerGlobals = Modules.getPeerGlobals(bundle.externals, bundleType);
356 let externals = Object.keys(peerGlobals);
357 if (!shouldBundleDependencies) {
358 const deps = Modules.getDependencies(bundleType, bundle.entry);
scripts/rollup/modules.js
+2 -2
@@ -27,12 +27,12 @@ const knownGlobals = Object.freeze({
27 });
28
29 // Given ['react'] in bundle externals, returns { 'react': 'React' }.
30 -function getPeerGlobals(externals, moduleType) {
30 +function getPeerGlobals(externals, bundleType) {
31 const peerGlobals = {};
32 externals.forEach(name => {
33 if (
34 !knownGlobals[name] &&
35 - (moduleType === UMD_DEV || moduleType === UMD_PROD)
35 + (bundleType === UMD_DEV || bundleType === UMD_PROD)
36 ) {
37 throw new Error('Cannot build UMD without a global name for: ' + name);
38 }