Skip to content
Prev Previous commit
Next Next commit
use canary 40
  • Loading branch information
chargome committed Oct 6, 2025
commit 1d46b0e32989150e730ac72e75fda1e8e9ca6327
4 changes: 2 additions & 2 deletions packages/nextjs/src/config/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ export function isTurbopackDefaultForVersion(version: string): boolean {
return true;
}

// For Next.js 15, only canary versions 15.6.0-canary.38+ use turbopack by default
// For Next.js 15, only canary versions 15.6.0-canary.40+ use turbopack by default
// Stable 15.x releases still use webpack by default
if (major === 15 && minor >= 6 && prerelease && prerelease.startsWith('canary.')) {
if (minor >= 7) {
return true;
}
const canaryNumber = parseInt(prerelease.split('.')[1] || '0', 10);
if (canaryNumber >= 38) {
if (canaryNumber >= 40) {
return true;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Turbopack Version Threshold Mismatch

The isTurbopackDefaultForVersion function has inconsistencies in determining Turbopack as default for Next.js 15.x canary versions. The code's 15.6.0-canary.40+ threshold conflicts with a comment stating 15.6.0-canary.38, leading to incorrect identification for 15.6.0-canary.38 and 15.6.0-canary.39. Additionally, a comment inaccurately restricts the default to 15.6.0-canary.40+, while the logic correctly includes all 15.7.x-canary versions.

Additional Locations (1)

Fix in Cursor Fix in Web

Expand Down
26 changes: 13 additions & 13 deletions packages/nextjs/test/config/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ describe('util', () => {
['18.0.0', 'Next.js 18.0.0'],
['20.0.0', 'Next.js 20.0.0'],

// Next.js 15.6.0-canary.38+ (boundary case)
['15.6.0-canary.38', 'Next.js 15.6.0-canary.38 (exact threshold)'],
['15.6.0-canary.39', 'Next.js 15.6.0-canary.39'],
['15.6.0-canary.40', 'Next.js 15.6.0-canary.40'],
// Next.js 15.6.0-canary.40+ (boundary case)
['15.6.0-canary.40', 'Next.js 15.6.0-canary.40 (exact threshold)'],
['15.6.0-canary.41', 'Next.js 15.6.0-canary.41'],
['15.6.0-canary.42', 'Next.js 15.6.0-canary.42'],
['15.6.0-canary.100', 'Next.js 15.6.0-canary.100'],

// Next.js 15.7+ canary versions
Expand All @@ -134,10 +134,10 @@ describe('util', () => {

describe('returns false for versions where webpack is still default', () => {
it.each([
// Next.js 15.6.0-canary.37 and below
['15.6.0-canary.37', 'Next.js 15.6.0-canary.37 (just below threshold)'],
// Next.js 15.6.0-canary.39 and below
['15.6.0-canary.39', 'Next.js 15.6.0-canary.39 (just below threshold)'],
['15.6.0-canary.36', 'Next.js 15.6.0-canary.36'],
['15.6.0-canary.1', 'Next.js 15.6.0-canary.1'],
['15.6.0-canary.38', 'Next.js 15.6.0-canary.38'],
['15.6.0-canary.0', 'Next.js 15.6.0-canary.0'],

// Next.js 15.6.x stable releases (NOT canary)
Expand Down Expand Up @@ -198,12 +198,12 @@ describe('util', () => {
expect(() => util.isTurbopackDefaultForVersion(version)).not.toThrow();
});

it('handles canary.38 exactly (boundary)', () => {
expect(util.isTurbopackDefaultForVersion('15.6.0-canary.38')).toBe(true);
it('handles canary.40 exactly (boundary)', () => {
expect(util.isTurbopackDefaultForVersion('15.6.0-canary.40')).toBe(true);
});

it('handles canary.37 exactly (boundary)', () => {
expect(util.isTurbopackDefaultForVersion('15.6.0-canary.37')).toBe(false);
it('handles canary.39 exactly (boundary)', () => {
expect(util.isTurbopackDefaultForVersion('15.6.0-canary.39')).toBe(false);
});
});
});
Expand Down Expand Up @@ -238,8 +238,8 @@ describe('util', () => {
expect(util.detectActiveBundler('17.0.0')).toBe('turbopack');
});

it('returns turbopack for Next.js 15.6.0-canary.38+', () => {
expect(util.detectActiveBundler('15.6.0-canary.38')).toBe('turbopack');
it('returns turbopack for Next.js 15.6.0-canary.40+', () => {
expect(util.detectActiveBundler('15.6.0-canary.40')).toBe('turbopack');
expect(util.detectActiveBundler('15.6.0-canary.50')).toBe('turbopack');
});

Expand Down
10 changes: 5 additions & 5 deletions packages/nextjs/test/config/withSentryConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ describe('withSentryConfig', () => {
});
});

describe('Next.js 15.6.0-canary.38+ defaults to turbopack', () => {
it('uses turbopack config by default for 15.6.0-canary.38', () => {
vi.spyOn(util, 'getNextjsVersion').mockReturnValue('15.6.0-canary.38');
describe('Next.js 15.6.0-canary.40+ defaults to turbopack', () => {
it('uses turbopack config by default for 15.6.0-canary.40', () => {
vi.spyOn(util, 'getNextjsVersion').mockReturnValue('15.6.0-canary.40');

const finalConfig = materializeFinalNextConfig(exportedNextConfig);

Expand All @@ -353,8 +353,8 @@ describe('withSentryConfig', () => {
expect(finalConfig.webpack).toBe(exportedNextConfig.webpack);
});

it('uses webpack when --webpack flag is present on 15.6.0-canary.38', () => {
vi.spyOn(util, 'getNextjsVersion').mockReturnValue('15.6.0-canary.38');
it('uses webpack when --webpack flag is present on 15.6.0-canary.40', () => {
vi.spyOn(util, 'getNextjsVersion').mockReturnValue('15.6.0-canary.40');
process.argv.push('--webpack');

const finalConfig = materializeFinalNextConfig(exportedNextConfig);
Expand Down
Loading