Skip to content

Commit b2d9da8

Browse files
committed
Remove the no longer required dynamicRequire hack to fix scope memory leak
1 parent f2a3c28 commit b2d9da8

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

packages/hub/src/hub.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ import {
1212
SpanContext,
1313
User,
1414
} from '@sentry/types';
15-
import {
16-
consoleSandbox,
17-
dynamicRequire,
18-
getGlobalObject,
19-
isNodeEnv,
20-
logger,
21-
timestampWithMs,
22-
uuid4,
23-
} from '@sentry/utils';
15+
import { consoleSandbox, getGlobalObject, isNodeEnv, logger, timestampWithMs, uuid4 } from '@sentry/utils';
2416

2517
import { Carrier, Layer } from './interfaces';
2618
import { Scope } from './scope';
@@ -462,10 +454,7 @@ export function getCurrentHub(): Hub {
462454
*/
463455
function getHubFromActiveDomain(registry: Carrier): Hub {
464456
try {
465-
// We need to use `dynamicRequire` because `require` on it's own will be optimized by webpack.
466-
// We do not want this to happen, we need to try to `require` the domain node module and fail if we are in browser
467-
// for example so we do not have to shim it and use `getCurrentHub` universally.
468-
const domain = dynamicRequire(module, 'domain');
457+
const domain = require('domain');
469458
const activeDomain = domain.active;
470459

471460
// If there no active domain, just return global hub

0 commit comments

Comments
 (0)