Question presented to candidate: "We want to host a Next.js marketing site on plain static hosting β an S3 bucket behind a CDN, no Node server. How does static export work, what do we get in the output, and which Next.js features will we lose?"
What a strong answer should cover:
output: "export"innext.configmakesnext buildwrite HTML, CSS, JS and RSC payload files toout/, one HTML file per route; it replaced thenext exportcommand (removed in v14).- Server Components still run, but only at build time; Client Components hydrate and client navigation works like an SPA. GET Route Handlers with
force-staticbecome static files. - Dynamic routes need
generateStaticParams; anything per-request is unsupported:cookies()/headers(), Server Actions, ISR, Draft Mode, rewrites/redirects/headers config, proxy, request-reading Route Handlers, intercepting routes, default image optimization. - Some of these fail the build, but some only warn or pass silently (rewrites, proxy,
revalidate, the default image loader in the lab), so test the output on a static server. - Hosting detail: map
/abouttoabout.html(or usetrailingSlash: true) and serve404.html.
Clarifying questions expected:
- "Does any page need per-user data or form submissions to our own backend?" β that needs a server or an external API.
- "How often does content change?" β every change needs a rebuild and redeploy, there is no ISR.
Code / implementation expected: Yes β the config and a dynamic route with generateStaticParams.