Skip to content

Commit 366c4bb

Browse files
authored
Don't let UMD create extraneous global variables (#10935)
1 parent 3a4c2a6 commit 366c4bb

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

scripts/rollup/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,9 @@ function getPlugins(
350350
languageOut: 'ECMASCRIPT5_STRICT',
351351
env: 'CUSTOM',
352352
warningLevel: 'QUIET',
353-
assumeFunctionWrapper: true,
353+
// Don't let it create global variables in the browser.
354+
// https://github.com/facebook/react/issues/10909
355+
assumeFunctionWrapper: bundleType !== UMD_PROD,
354356
applyInputSourceMaps: false,
355357
useTypesForOptimization: false,
356358
processCommonJsModules: false,

scripts/rollup/results.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"gzip": 16507
66
},
77
"react.production.min.js (UMD_PROD)": {
8-
"size": 6598,
9-
"gzip": 2753
8+
"size": 6634,
9+
"gzip": 2764
1010
},
1111
"react.development.js (NODE_DEV)": {
1212
"size": 55305,
@@ -29,8 +29,8 @@
2929
"gzip": 148516
3030
},
3131
"react-dom.production.min.js (UMD_PROD)": {
32-
"size": 102900,
33-
"gzip": 32047
32+
"size": 101633,
33+
"gzip": 32093
3434
},
3535
"react-dom.development.js (NODE_DEV)": {
3636
"size": 606589,
@@ -61,8 +61,8 @@
6161
"gzip": 22083
6262
},
6363
"react-dom-unstable-native-dependencies.production.min.js (UMD_PROD)": {
64-
"size": 15415,
65-
"gzip": 5073
64+
"size": 15432,
65+
"gzip": 5071
6666
},
6767
"react-dom-unstable-native-dependencies.development.js (NODE_DEV)": {
6868
"size": 81143,
@@ -85,8 +85,8 @@
8585
"gzip": 34451
8686
},
8787
"react-dom-server.browser.production.min.js (UMD_PROD)": {
88-
"size": 14959,
89-
"gzip": 5859
88+
"size": 14948,
89+
"gzip": 5844
9090
},
9191
"react-dom-server.browser.development.js (NODE_DEV)": {
9292
"size": 104475,

0 commit comments

Comments
 (0)