Question presented to candidate: "What goes into next.config.js, which options do you most often touch, and how do you catch mistakes in it?"
What a strong answer should cover:
next.config.ts(or.js/.mjs) exports an object or function that configures the build and the server; TypeScript config gets theNextConfigtype.- Common options:
images(remotePatterns, formats, qualities),redirects,rewrites,headers,output,serverExternalPackages,turbopack,cacheComponentsandcacheLife,reactCompiler,experimental. - It is loaded by the Node.js server and build, not bundled for the browser; env values used there are read at build or start.
- Next.js validates it: unknown or moved keys print warnings with the new name.
- It can export a function that receives the phase (development, build, production server) to vary settings.
Clarifying questions expected:
- "Which Next.js version?" β keys move between versions (for example serverComponentsExternalPackages).
- "Is this for the build or runtime behaviour?" β some options only affect one of them.
Code / implementation expected: Yes β a typed config with the common options.