feat: add turbopack support for Next.js v16#43
Merged
Conversation
Next.js v16 defaults to Turbopack. The plugin previously hardcoded webpack for both build and serve, disabling turbopack entirely. - Add `webpack` boolean plugin option (defaults to false) so users can opt into webpack when needed, mirroring the `next build --webpack` CLI flag - Update `withHarper()` to include a `turbopack` config key, preventing Next.js v16 from erroring when it sees a webpack config without one - Add `next-16-webpack` fixture and integration test to cover both bundler paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kriszyp
approved these changes
May 6, 2026
5 tasks
* feat: add turbopack support for Next.js v15 and refactor bundler option Replace the `webpack: boolean` plugin option with a `bundler` option that accepts "webpack" or "turbopack". The default is version-aware: - v16: turbopack (matches Next.js v16 default) - v15: webpack (matches Next.js v15 default) - v14: webpack (no turbopack support) Users can now explicitly set `bundler: turbopack` for v15 to opt in, or `bundler: webpack` for v16 to opt out. - Add `next-15-turbopack` fixture and integration test - Update `next-16-webpack` fixture to use `bundler: webpack` Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add v14 turbopack guard and validate all versions (#45) Next.js v14 does not support turbopack via the createServer or nextBuild APIs. Log an error and fall back to webpack if a user sets `bundler: turbopack` with a v14 application. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cb1kenobi
approved these changes
May 6, 2026
Member
cb1kenobi
left a comment
There was a problem hiding this comment.
This works like a champ! Nice work!
[http/1] [debug]: Building Next.js application at /Users/chris/project
▲ Next.js 16.2.4 (Turbopack)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
webpackboolean plugin option (defaults tofalse) so v16 uses turbopack by default, matching the standard Next.js developer experience. Users can setwebpack: trueto opt back into webpack, mirroring thenext build --webpackCLI flag.withHarper()to include aturbopackconfig key in the returned Next.js config. Without this, Next.js v16 errors when it detects awebpackconfig function (added bywithHarper) with no correspondingturbopackconfig.webpackoption is ignored for those versions.Test plan
npm run build— TypeScript compiles cleannext-16.pw.ts— turbopack path (default): 3/3 passednext-16-webpack.pw.ts— webpack path (webpack: true): 3/3 passed🤖 Generated with Claude Code
Now incorporates changes from #44 and #45 too for v14 and v15 support.