From c976f5dbb2bbd5dde2a9dcc24b5111019639d1bc Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Wed, 6 May 2026 08:58:28 -0600 Subject: [PATCH] feat: add v14 turbopack guard and validate all versions 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) --- src/plugin.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin.ts b/src/plugin.ts index 283ab3a..fad6802 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -197,6 +197,11 @@ export async function handleApplication(scope: Scope) { config.bundler = next.version >= 16 ? 'turbopack' : 'webpack'; } + if (config.bundler === 'turbopack' && next.version === 14) { + scope.logger.error?.('Turbopack is not supported for Next.js v14. Falling back to webpack.'); + config.bundler = 'webpack'; + } + scope.logger.debug?.(`Detected Next.js version: ${next.version}`); if (config.prebuilt) {