Skip to content

Commit b4c72c9

Browse files
Luca ForstnerAbhiPrasad
authored andcommitted
refine
1 parent b5cd99d commit b4c72c9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/nextjs/src/config/templates/serverComponentWrapperTemplate.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
import * as wrapee from '__SENTRY_WRAPPING_TARGET_FILE__';
1212
// eslint-disable-next-line import/no-extraneous-dependencies
1313
import * as Sentry from '@sentry/nextjs';
14-
// @ts-ignore TODO
14+
// @ts-ignore This template is only used with the app directory so we know that this dependency exists.
1515
// eslint-disable-next-line import/no-unresolved
1616
import { headers } from 'next/headers';
1717

18+
declare function headers(): { get: (header: string) => string | undefined };
19+
1820
type ServerComponentModule = {
1921
default: unknown;
2022
};
@@ -32,13 +34,8 @@ if (typeof serverComponent === 'function') {
3234
let baggageHeader: string | undefined = undefined;
3335

3436
if (process.env.NEXT_PHASE !== 'phase-production-build') {
35-
// @ts-ignore TODO
36-
// eslint-disable-next-line import/no-unresolved
37-
// const { headers } = await import('next/headers');
3837
const headersList = headers();
39-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4038
sentryTraceHeader = headersList.get('sentry-trace');
41-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
4239
baggageHeader = headersList.get('baggage');
4340
}
4441

0 commit comments

Comments
 (0)