Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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