From 5934f6f2e2c801ccf6e7f4f71cf5390db97a73f2 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 19 May 2023 11:43:52 +0200 Subject: [PATCH] fix(nextjs): Make `withSentryConfig` isomorphic --- packages/nextjs/src/client/index.ts | 7 +++++++ packages/nextjs/src/edge/index.ts | 7 +++++++ packages/nextjs/src/index.types.ts | 2 ++ 3 files changed, 16 insertions(+) diff --git a/packages/nextjs/src/client/index.ts b/packages/nextjs/src/client/index.ts index d0be07a3c8d0..665b557e4e7b 100644 --- a/packages/nextjs/src/client/index.ts +++ b/packages/nextjs/src/client/index.ts @@ -123,6 +123,13 @@ function addClientIntegrations(options: BrowserOptions): void { options.integrations = integrations; } +/** + * Just a passthrough in case this is imported from the client. + */ +export function withSentryConfig(exportedUserNextConfig: T): T { + return exportedUserNextConfig; +} + export { // eslint-disable-next-line deprecation/deprecation withSentryServerSideGetInitialProps, diff --git a/packages/nextjs/src/edge/index.ts b/packages/nextjs/src/edge/index.ts index ca56ce3facbe..8e8edfdc3b07 100644 --- a/packages/nextjs/src/edge/index.ts +++ b/packages/nextjs/src/edge/index.ts @@ -126,6 +126,13 @@ export function lastEventId(): string | undefined { return getCurrentHub().lastEventId(); } +/** + * Just a passthrough in case this is imported from the client. + */ +export function withSentryConfig(exportedUserNextConfig: T): T { + return exportedUserNextConfig; +} + export { flush } from './utils/flush'; export * from '@sentry/core'; diff --git a/packages/nextjs/src/index.types.ts b/packages/nextjs/src/index.types.ts index a75b61e02ea3..6fcf7436399b 100644 --- a/packages/nextjs/src/index.types.ts +++ b/packages/nextjs/src/index.types.ts @@ -39,6 +39,8 @@ export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary; export declare const Span: typeof edgeSdk.Span; export declare const Transaction: typeof edgeSdk.Transaction; +export { withSentryConfig } from './config'; + /** * @deprecated Use `wrapApiHandlerWithSentry` instead */