From e4f64629c01b13cdb9510216a919aad0d3489c30 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 28 Sep 2017 20:16:56 +0100 Subject: [PATCH] Don't let UMD create extraneous global variables --- scripts/rollup/build.js | 4 +++- scripts/rollup/results.json | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/scripts/rollup/build.js b/scripts/rollup/build.js index e3cbf2d59e72d..3ef229f943453 100644 --- a/scripts/rollup/build.js +++ b/scripts/rollup/build.js @@ -350,7 +350,9 @@ function getPlugins( languageOut: 'ECMASCRIPT5_STRICT', env: 'CUSTOM', warningLevel: 'QUIET', - assumeFunctionWrapper: true, + // Don't let it create global variables in the browser. + // https://github.com/facebook/react/issues/10909 + assumeFunctionWrapper: bundleType !== UMD_PROD, applyInputSourceMaps: false, useTypesForOptimization: false, processCommonJsModules: false, diff --git a/scripts/rollup/results.json b/scripts/rollup/results.json index cb30a926ab732..631a855ba6c7f 100644 --- a/scripts/rollup/results.json +++ b/scripts/rollup/results.json @@ -5,8 +5,8 @@ "gzip": 16507 }, "react.production.min.js (UMD_PROD)": { - "size": 6598, - "gzip": 2753 + "size": 6634, + "gzip": 2764 }, "react.development.js (NODE_DEV)": { "size": 55305, @@ -29,8 +29,8 @@ "gzip": 148516 }, "react-dom.production.min.js (UMD_PROD)": { - "size": 102900, - "gzip": 32047 + "size": 101633, + "gzip": 32093 }, "react-dom.development.js (NODE_DEV)": { "size": 606589, @@ -61,8 +61,8 @@ "gzip": 22083 }, "react-dom-unstable-native-dependencies.production.min.js (UMD_PROD)": { - "size": 15415, - "gzip": 5073 + "size": 15432, + "gzip": 5071 }, "react-dom-unstable-native-dependencies.development.js (NODE_DEV)": { "size": 81143, @@ -85,8 +85,8 @@ "gzip": 34451 }, "react-dom-server.browser.production.min.js (UMD_PROD)": { - "size": 14959, - "gzip": 5859 + "size": 14948, + "gzip": 5844 }, "react-dom-server.browser.development.js (NODE_DEV)": { "size": 104475,