Skip to content

Commit 0d2e3b1

Browse files
committed
fix(nextjs): Import Claude Code exports before re-exporting to prevent undefined
1 parent 375cd16 commit 0d2e3b1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/nextjs/src/server/index.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ import {
2626
stripUrlQueryAndFragment,
2727
} from '@sentry/core';
2828
import type { NodeClient, NodeOptions } from '@sentry/node';
29-
import { getDefaultIntegrations, httpIntegration, init as nodeInit } from '@sentry/node';
29+
import {
30+
getDefaultIntegrations,
31+
httpIntegration,
32+
init as nodeInit,
33+
claudeCodeIntegration,
34+
createInstrumentedClaudeQuery,
35+
patchClaudeCodeQuery,
36+
} from '@sentry/node';
3037
import { getScopesFromContext } from '@sentry/opentelemetry';
3138
import { DEBUG_BUILD } from '../common/debug-build';
3239
import { devErrorSymbolicationEventProcessor } from '../common/devErrorSymbolicationEventProcessor';
@@ -46,7 +53,12 @@ import { distDirRewriteFramesIntegration } from './distDirRewriteFramesIntegrati
4653
export * from '@sentry/node';
4754

4855
// Explicit re-exports for Claude Code integration
49-
export { claudeCodeIntegration, createInstrumentedClaudeQuery, patchClaudeCodeQuery } from '@sentry/node';
56+
// We re-export these explicitly to ensure rollup doesn't tree-shake them
57+
export { claudeCodeIntegration, createInstrumentedClaudeQuery, patchClaudeCodeQuery };
58+
59+
// Force rollup to keep the imports by "using" them
60+
const _forceInclude = { claudeCodeIntegration, createInstrumentedClaudeQuery, patchClaudeCodeQuery };
61+
if (false as boolean) { console.log(_forceInclude); }
5062

5163
export { captureUnderscoreErrorException } from '../common/pages-router-instrumentation/_error';
5264

0 commit comments

Comments
 (0)