From c57e00048f9f8e97fcfd3ff231658abd5afc3c83 Mon Sep 17 00:00:00 2001 From: Mathieu Dumont Date: Thu, 26 Mar 2020 05:13:17 -0400 Subject: [PATCH] fix: Remove the no longer required dynamicRequire hack to fix scope memory leak (#2515) --- packages/hub/src/hub.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/hub/src/hub.ts b/packages/hub/src/hub.ts index 5886c3707e82..a559abbb5627 100644 --- a/packages/hub/src/hub.ts +++ b/packages/hub/src/hub.ts @@ -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'; @@ -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