Question presented to candidate: "A package with native binaries breaks when Next.js bundles it for Server Components. What does serverComponentsExternalPackages do, what is it called now, and when do you need it?"
What a strong answer should cover:
- By default Next.js bundles the dependencies of Server Components and Route Handlers into the server output.
- Some packages break when bundled: native addons, packages that read their own files at runtime, or packages with dynamic requires.
serverExternalPackages(renamed fromexperimental.serverComponentsExternalPackagesin Next.js 15) tells Next.js to leave those packages unbundled andrequirethem from node_modules at runtime.- Next.js already keeps a built-in list of such packages external (for example Prisma and sharp), so most apps never need to configure it.
- The old experimental key is flagged as invalid, but Next.js still maps it to the new option and prints a warning.
Clarifying questions expected:
- "What is the exact build or runtime error?" — module-not-found for a binary or a missing file points to bundling.
- "Is the package already on the built-in list?" — then the problem is elsewhere.
Code / implementation expected: Yes — the config option and what changes in the build output.