File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 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';
1212let didWarnAboutMessageChannel = false ;
1313let enqueueTask ;
1414try {
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 ] ;
1519 // 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 ;
1922} catch ( _err ) {
2023 // we're in a browser
2124 // we can't use regular timers because they may still be faked
You can’t perform that action at this time.
0 commit comments