Skip to content

Commit

Permalink
feat(nextjs): Export common shims for server and edge nextjs modules
Browse files Browse the repository at this point in the history
Export common shims (BrowserTracing, Feedback, Replay) to improve DX by:
- logging error when server/edge SDK inits invoke client only modules
- avoiding compilation warnings for uninvoked client only configuration

Fixes GH-9796
  • Loading branch information
curiousercreative committed Dec 12, 2023
1 parent 93bbeb7 commit 7ba1bf8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/nextjs/src/edge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import type { SdkMetadata } from '@sentry/types';
import { GLOBAL_OBJ, addOrUpdateIntegration, escapeStringForRegex } from '@sentry/utils';
import type { VercelEdgeOptions } from '@sentry/vercel-edge';
import { init as vercelEdgeInit } from '@sentry/vercel-edge';
// This is exported to warn when server/edge SDK inits invoke client only modules and to avoid compilation warnings for uninvoked client only configuration
export { BrowserTracing, Feedback, Replay } from '@sentry-internal/integration-shims';

import { isBuild } from '../common/utils/isBuild';

Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/src/index.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from './client';
export * from './server';
export * from './edge';

export type { BrowserTracing, Feedback, Replay } from '@sentry/react';
import type { Integration, Options, StackParser } from '@sentry/types';

import type * as clientSdk from './client';
Expand Down
2 changes: 2 additions & 0 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { Integrations, configureScope, getCurrentHub, init as nodeInit } from '@
import type { EventProcessor } from '@sentry/types';
import type { IntegrationWithExclusionOption } from '@sentry/utils';
import { addOrUpdateIntegration, escapeStringForRegex, logger } from '@sentry/utils';
// This is exported to warn when server/edge SDK inits invoke client only modules and to avoid compilation warnings for uninvoked client only configuration
export { BrowserTracing, Feedback, Replay } from '@sentry-internal/integration-shims';

import { DEBUG_BUILD } from '../common/debug-build';
import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolicationEventProcessor';
Expand Down

0 comments on commit 7ba1bf8

Please sign in to comment.