File tree 5 files changed +30
-19
lines changed 5 files changed +30
-19
lines changed Original file line number Diff line number Diff line change @@ -84,5 +84,6 @@ module.exports = {
84
84
spyOnDevAndProd : true ,
85
85
spyOnProd : true ,
86
86
__PROFILE__ : true ,
87
+ __UMD__ : true ,
87
88
} ,
88
89
} ;
Original file line number Diff line number Diff line change @@ -31,28 +31,35 @@ const ReactSharedInternals = {
31
31
ReactCurrentOwner,
32
32
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
33
33
assign,
34
+ } ;
35
+
36
+ if ( __UMD__ ) {
34
37
// Re-export the react-scheduler API(s) for UMD bundles.
35
38
// This avoids introducing a dependency on a new UMD global in a minor update,
36
39
// Since that would be a breaking change (e.g. for all existing CodeSandboxes).
37
- Scheduler : {
38
- cancelScheduledWork,
39
- now,
40
- scheduleWork,
41
- } ,
42
- SchedulerTracking : {
43
- __getInteractionsRef,
44
- __getSubscriberRef,
45
- clear,
46
- getCurrent,
47
- getThreadID,
48
- track,
49
- wrap,
50
- } ,
51
- SchedulerTrackingSubscriptions : {
52
- subscribe,
53
- unsubscribe,
54
- } ,
55
- } ;
40
+ // This re-export is only required for UMD bundles;
41
+ // CJS bundles use the shared NPM package.
42
+ Object . assign ( ReactSharedInternals , {
43
+ Scheduler : {
44
+ cancelScheduledWork,
45
+ now,
46
+ scheduleWork,
47
+ } ,
48
+ SchedulerTracking : {
49
+ __getInteractionsRef,
50
+ __getSubscriberRef,
51
+ clear,
52
+ getCurrent,
53
+ getThreadID,
54
+ track,
55
+ wrap,
56
+ } ,
57
+ SchedulerTrackingSubscriptions : {
58
+ subscribe,
59
+ unsubscribe,
60
+ } ,
61
+ } ) ;
62
+ }
56
63
57
64
if ( __DEV__ ) {
58
65
Object . assign ( ReactSharedInternals , {
Original file line number Diff line number Diff line change 10
10
/* eslint-disable */
11
11
12
12
declare var __PROFILE__: boolean ;
13
+ declare var __UMD__: boolean ;
13
14
14
15
declare var __REACT_DEVTOOLS_GLOBAL_HOOK__: any ; /*?{
15
16
inject: ?((stuff: Object) => void)
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ if (NODE_ENV !== 'development' && NODE_ENV !== 'production') {
6
6
}
7
7
global . __DEV__ = NODE_ENV === 'development' ;
8
8
global . __PROFILE__ = NODE_ENV === 'development' ;
9
+ global . __UMD__ = false ;
9
10
10
11
if ( typeof window !== 'undefined' ) {
11
12
global . requestAnimationFrame = function ( callback ) {
Original file line number Diff line number Diff line change @@ -325,6 +325,7 @@ function getPlugins(
325
325
replace ( {
326
326
__DEV__ : isProduction ? 'false' : 'true' ,
327
327
__PROFILE__ : isProfiling || ! isProduction ? 'true' : 'false' ,
328
+ __UMD__ : isUMDBundle ? 'true' : 'false' ,
328
329
'process.env.NODE_ENV' : isProduction ? "'production'" : "'development'" ,
329
330
} ) ,
330
331
// We still need CommonJS for external deps like object-assign.
You can’t perform that action at this time.
0 commit comments