Skip to content

Commit 6a275c0

Browse files
authored
fix(nextjs): Export Replay from index.server.ts to avoid TS error (#6577)
This patch fixes a TypeScript error when using the `Replay` integration exported from the NextJS SDK (>= 7.27.0). Because our SDK tells TS that it should import types from `index.server.ts`, TS doesn't find the Replay integration class although it's correctly exported from `indext.client.ts`. Note: even without this change, Replay works in NextJS, it just fixes just a TS error.
1 parent 2fa11eb commit 6a275c0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/nextjs/src/index.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import { addOrUpdateIntegration, IntegrationWithExclusionOption } from './utils/
1515
export * from '@sentry/node';
1616
export { captureUnderscoreErrorException } from './utils/_error';
1717

18+
// Exporting the Replay integration also from index.server.ts because TS only recognizes types from index.server.ts
19+
// If we didn't export this, TS would complain that it can't find `Sentry.Replay` in the package,
20+
// causing a build failure, when users initialize Replay in their sentry.client.config.js/ts file.
21+
export { Replay } from './index.client';
22+
1823
// Here we want to make sure to only include what doesn't have browser specifics
1924
// because or SSR of next.js we can only use this.
2025
export { ErrorBoundary, showReportDialog, withErrorBoundary } from '@sentry/react';

0 commit comments

Comments
 (0)