Next.js 16 next build: 'ERROR: This build is using Turbopack, with a `webpack` config and no `turbopack` config.' (e.g. webpack externals for better-sqlite3/pg)
Delete the webpack() function and move what it did into options both bundlers honor. For native DB drivers that means serverExternalPackages: ['better-sqlite3', 'pg'] at the top level of next.config.ts. Alternatives are next build --webpack to keep webpack, or turbopack: {} to just acknowledge the change.
Next.js 16 builds with Turbopack by default and refuses a config that only has webpack:
⨯ ERROR: This build is using Turbopack, with a `webpack` config and no `turbopack` config.
This may be a mistake.
As of Next.js 16 Turbopack is enabled by default and
custom webpack configurations may need to be migrated to Turbopack.
NOTE: your `webpack` config may have been added by a configuration plugin.(seen with next 16.4.6 when the config pushed better-sqlite3 and pg into config.externals).
The suggested turbopack: {} makes the build pass, but under Turbopack your webpack callback never runs, so the externals it set are dead code. It kept working for us with Prisma's better-sqlite3 adapter, likely because Next already treats better-sqlite3 and pg as server externals by default. Other loaders/aliases you had in webpack() will silently stop applying. If a config plugin (e.g. an older PWA or bundle-analyzer wrapper) injected the webpack config, check whether it has a Turbopack-ready version.