Skip to content

Commit

Permalink
fix: Remove the no longer required dynamicRequire hack to fix scope m…
Browse files Browse the repository at this point in the history
…emory leak (#2515)
  • Loading branch information
Madumo committed Mar 26, 2020
1 parent f2a3c28 commit c57e000
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/hub/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ import {
SpanContext,
User,
} from '@sentry/types';
import {
consoleSandbox,
dynamicRequire,
getGlobalObject,
isNodeEnv,
logger,
timestampWithMs,
uuid4,
} from '@sentry/utils';
import { consoleSandbox, getGlobalObject, isNodeEnv, logger, timestampWithMs, uuid4 } from '@sentry/utils';

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

// If there no active domain, just return global hub
Expand Down

0 comments on commit c57e000

Please sign in to comment.