Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions packages/nextjs/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ export function init(options: BrowserOptions): Client | undefined {
}

try {
// @ts-expect-error `process.turbopack` is a magic string that will be replaced by Next.js
if (process.turbopack) {
if (process.env.TURBOPACK) {
Copy link

Choose a reason for hiding this comment

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

Bug: Turbopack Detection Regression

Replacing process.turbopack with process.env.TURBOPACK breaks Next.js's build-time magic string replacement for Turbopack detection. This implementation also doesn't align with the PR description, which proposed a fallback checking both process.env.TURBOPACK and process.turbopack to ensure detection works as expected.

Additional Locations (2)

Fix in Cursor Fix in Web

getGlobalScope().setTag('turbopack', true);
}
} catch {
Expand Down
3 changes: 1 addition & 2 deletions packages/nextjs/src/edge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ export function init(options: VercelEdgeOptions = {}): void {
});

try {
// @ts-expect-error `process.turbopack` is a magic string that will be replaced by Next.js
if (process.turbopack) {
if (process.env.TURBOPACK) {
getGlobalScope().setTag('turbopack', true);
}
} catch {
Expand Down
3 changes: 1 addition & 2 deletions packages/nextjs/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ export function init(options: NodeOptions): NodeClient | undefined {
}

try {
// @ts-expect-error `process.turbopack` is a magic string that will be replaced by Next.js
if (process.turbopack) {
if (process.env.TURBOPACK) {
getGlobalScope().setTag('turbopack', true);
}
} catch {
Expand Down