Skip to content

Commit ebd7d09

Browse files
author
Luca Forstner
committed
feat(nextjs): Support instrumentation-client.ts
1 parent 2b55265 commit ebd7d09

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,12 @@ function warnAboutDeprecatedConfigFiles(
531531
* @param projectDir The root directory of the project, where config files would be located
532532
*/
533533
export function getClientSentryConfigFile(projectDir: string): string | void {
534-
const possibilities = ['sentry.client.config.ts', 'sentry.client.config.js'];
534+
const possibilities = [
535+
'sentry.client.config.ts',
536+
'sentry.client.config.js',
537+
'instrumentation-client.ts',
538+
'src/instrumentation-client.ts',
539+
];
535540

536541
for (const filename of possibilities) {
537542
if (fs.existsSync(path.resolve(projectDir, filename))) {

packages/nextjs/src/config/withSentryConfig.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,19 @@ function getFinalConfigObject(
153153
}
154154
}
155155

156-
if (process.env.TURBOPACK && !process.env.SENTRY_SUPPRESS_TURBOPACK_WARNING) {
157-
// eslint-disable-next-line no-console
158-
console.warn(
159-
`[@sentry/nextjs] WARNING: You are using the Sentry SDK with \`next ${
160-
process.env.NODE_ENV === 'development' ? 'dev' : 'build'
161-
} --turbo\`. The Sentry SDK doesn't yet fully support Turbopack. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. ${
162-
process.env.NODE_ENV === 'development' ? 'Production builds without `--turbo` will still fully work. ' : ''
163-
}If you are just trying out Sentry or attempting to configure the SDK, we recommend temporarily removing the \`--turbo\` flag while you are developing locally. Follow this issue for progress on Sentry + Turbopack: https://github.com/getsentry/sentry-javascript/issues/8105. (You can suppress this warning by setting SENTRY_SUPPRESS_TURBOPACK_WARNING=1 as environment variable)`,
164-
);
156+
if (process.env.TURBOPACK) {
157+
// TODO: Emit different warning when on Next.js version that supports instrumentation-client.ts
158+
159+
if (!process.env.SENTRY_SUPPRESS_TURBOPACK_WARNING) {
160+
// eslint-disable-next-line no-console
161+
console.warn(
162+
`[@sentry/nextjs] WARNING: You are using the Sentry SDK with \`next ${
163+
process.env.NODE_ENV === 'development' ? 'dev' : 'build'
164+
} --turbo\`. The Sentry SDK doesn't yet fully support Turbopack. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. ${
165+
process.env.NODE_ENV === 'development' ? 'Production builds without `--turbo` will still fully work. ' : ''
166+
}If you are just trying out Sentry or attempting to configure the SDK, we recommend temporarily removing the \`--turbo\` flag while you are developing locally. Follow this issue for progress on Sentry + Turbopack: https://github.com/getsentry/sentry-javascript/issues/8105. (You can suppress this warning by setting SENTRY_SUPPRESS_TURBOPACK_WARNING=1 as environment variable)`,
167+
);
168+
}
165169
}
166170

167171
const releaseName = userSentryOptions.release?.name ?? getSentryRelease() ?? getGitRevision();

0 commit comments

Comments
 (0)