-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(nextjs): Prepare for next 16 bundler default #17868
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
Conversation
size-limit report 📦
|
dev-packages/e2e-tests/test-applications/nextjs-app-dir/tests/transactions.test.ts
Show resolved
Hide resolved
dev-packages/e2e-tests/test-applications/nextjs-app-dir/playwright.config.mjs
Show resolved
Hide resolved
Next.js will switch the default bundler starting with Next.js v16 - Updated detection logic for turbopack vs webpack - Updated generic tests (app dir + pages dir) to only run on webpack (we'll need to update these as soon as next16 is released) (there are tests that won't pass on turbopack and keeping this in sync for both bundlers will become unmaintainable) - Add a bunch of unit tests - Disabled `next dev --webpack` tests for now as instrumentation breaks – tracked in [linear](https://linear.app/getsentry/issue/FE-618/webpack-breaks-instrumentation-for-dev-mode-in-next-16) - Middleware tests failing likely due to missing [Proxy support ](getsentry#17894), will split this up in a follow up pr
export function detectActiveBundler(nextJsVersion: string | undefined): 'turbopack' | 'webpack' | undefined { | ||
if (process.env.TURBOPACK || process.argv.includes('--turbo')) { | ||
return 'turbopack'; | ||
} | ||
|
||
// Explicit opt-in to webpack via --webpack flag | ||
if (process.argv.includes('--webpack')) { | ||
return 'webpack'; | ||
} | ||
|
||
// Fallback to version-based default behavior | ||
if (nextJsVersion) { | ||
const turbopackIsDefault = isTurbopackDefaultForVersion(nextJsVersion); | ||
return turbopackIsDefault ? 'turbopack' : 'webpack'; | ||
} | ||
|
||
// Unlikely but at this point, we just assume webpack for older behavior | ||
return 'webpack'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chargome, this is incorrectly returning turbopack
for me. I'm running Next.js with Rspack and had to do some shenanigans to make it work after they changed the default bundler to Turbopack. So what I'm running is this:
NEXT_RSPACK=true next dev
NEXT_RSPACK=true next build
NEXT_RSPACK=true next start
I noticed our source maps stopped working in 10.20.0
and narrowed it down to this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a PR for this in #17971.
Next.js will switch the default bundler starting with Next.js v16
next dev --webpack
tests for now as instrumentation breaks – tracked in linearcloses https://linear.app/getsentry/issue/FE-617/support-new-default-bundling-behaviour-for-nextjs-16