File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,13 @@ import warningWithoutStack from './warningWithoutStack';
12
12
let didWarnAboutMessageChannel = false ;
13
13
let enqueueTask ;
14
14
try {
15
+ // read require off the module object to get around the bundlers.
16
+ // we don't want them to detect a require and bundle a Node polyfill.
17
+ let requireString = ( 'require' + Math . random ( ) ) . slice ( 0 , 7 ) ;
18
+ let nodeRequire = module && module [ requireString ] ;
15
19
// assuming we're in node, let's try to get node's
16
- // version of setImmediate, bypassing fake timers if any
17
- let r = require ; // trick packagers not to bundle this stuff.
18
- enqueueTask = r ( 'timers' ) . setImmediate ;
20
+ // version of setImmediate, bypassing fake timers if any.
21
+ enqueueTask = nodeRequire ( 'timers' ) . setImmediate ;
19
22
} catch ( _err ) {
20
23
// we're in a browser
21
24
// we can't use regular timers because they may still be faked
You can’t perform that action at this time.
0 commit comments