Skip to content

Commit 63863cd

Browse files
authored
feat(nextjs): Emit warning when using turbopack (#13566)
Ref: #8105 Emit a warning about certain incompatibilities when we detect a turbopack build (dev or prod build).
1 parent 50589cd commit 63863cd

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

packages/nextjs/src/config/withSentryConfig.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ function getFinalConfigObject(
103103
);
104104
}
105105

106+
if (process.env.TURBOPACK && !process.env.SENTRY_SUPPRESS_TURBOPACK_WARNING) {
107+
// eslint-disable-next-line no-console
108+
console.warn(
109+
`[@sentry/nextjs] WARNING: You are using the Sentry SDK with \`next ${
110+
process.env.NODE_ENV === 'development' ? 'dev' : 'build'
111+
} --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. ${
112+
process.env.NODE_ENV === 'development' ? 'Production builds without `--turbo` will still fully work. ' : ''
113+
}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)`,
114+
);
115+
}
116+
106117
return {
107118
...incomingUserNextConfigObject,
108119
webpack: constructWebpackConfigFunction(incomingUserNextConfigObject, userSentryOptions),

0 commit comments

Comments
 (0)