Skip to content

ref(nextjs): Completely deprecate isBuild() and IS_BUILD #6727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ const globalWithInjectedValues = global as typeof global & {

const domain = domainModule as typeof domainModule & { active: (domainModule.Domain & Carrier) | null };

// Exporting this constant means we can compute it without the linter complaining, even if we stop directly using it in
// this file. It's important that it be computed as early as possible, because one of its indicators is seeing 'build'
// (as in the CLI command `next build`) in `process.argv`. Later on in the build process, everything's been spun out
// into child threads and `argv` turns into ['node', 'path/to/childProcess.js'], so the original indicator is lost. We
// thus want to compute it as soon as the SDK is loaded for the first time, which is normally when the user imports
// `withSentryConfig` into `next.config.js`.
Comment on lines -27 to -32
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment was only applicable back when we had instrumentServer which we recently removed.

// TODO (v8): Remove this
/**
* @deprecated This constant will be removed in the next major update.
*/
export const IS_BUILD = isBuild();

const IS_VERCEL = !!process.env.VERCEL;

/** Inits the Sentry NextJS SDK on node. */
Expand Down Expand Up @@ -140,7 +139,7 @@ function addServerIntegrations(options: NodeOptions): void {

// TODO (v8): Remove this
/**
* @deprecated Use the constant `IS_BUILD` instead.
* @deprecated This constant will be removed in the next major update.
*/
const deprecatedIsBuild = (): boolean => isBuild();
// eslint-disable-next-line deprecation/deprecation
Expand Down