File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/nextjs/src/config Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -362,11 +362,16 @@ function getFinalConfigObject(
362362 resolved : spotlightConfig ,
363363 isTurbopack,
364364 isWebpack,
365+ isTurbopackSupported,
365366 } ) ;
366367
367368 let turboPackConfig : TurbopackOptions | undefined ;
368369
369- if ( isTurbopack ) {
370+ // IMPORTANT: Always construct turbopack config if the Next.js version supports it,
371+ // regardless of detected bundler. This is because Next.js 15+ uses Turbopack by
372+ // default for `next dev` without setting TURBOPACK=1, so our detection may be wrong.
373+ // Applying turbopack config when webpack is used is safe (webpack ignores it).
374+ if ( isTurbopack || isTurbopackSupported ) {
370375 turboPackConfig = constructTurbopackConfig ( {
371376 userNextConfig : incomingUserNextConfigObject ,
372377 userSentryOptions,
@@ -480,7 +485,10 @@ function getFinalConfigObject(
480485 } ) ,
481486 }
482487 : { } ) ,
483- ...( isTurbopackSupported && isTurbopack
488+ // Always apply turbopack config if supported, regardless of detected bundler.
489+ // Next.js 15+ uses Turbopack by default for `next dev` without setting TURBOPACK=1,
490+ // so we can't reliably detect which bundler will be used. Safe to apply both configs.
491+ ...( isTurbopackSupported && turboPackConfig
484492 ? {
485493 turbopack : turboPackConfig ,
486494 }
You can’t perform that action at this time.
0 commit comments