For Next.js 14, static export suits routes that can be produced at build time. A project using request-time server features needs an appropriate runtime deployment instead. Choose based on the application features, then confirm that the hosting environment supports the resulting output.
Check the features before changing configuration
In Next.js 14, static export uses output: 'export' in the Next configuration. The build produces an out directory. Request-dependent route handlers, cookies, middleware and other runtime features have restrictions documented by Next.js; the default image optimizer also needs a different approach for a static export. Review the documentation for your installed version, rather than assuming all framework features survive an export.
Build and inspect the result
Run the project's normal production build in a separate working copy. If static export is appropriate, confirm that the expected pages and assets appear in the output. Open an inner route directly, refresh it, and test links between pages. The server's file and URL rules must match the generated layout.
- A successful homepage is only the first check; test an inner page without navigating from home.
- Test the actual form or API action, including any external service it calls.
- Check image loading and asset paths on the intended domain and subdirectory.
- Do not copy a local environment file into a public output folder.
When a runtime is the better fit
Keep a runtime deployment when the application relies on server behavior that cannot be exported. Record the Node.js requirement, build command, start command and persistent data. A VPS can provide an environment for a running process, but process supervision, domain routing and HTTPS still need configuration.
Prepare a deployment brief before selecting resources. For the IIS/iisnode route specifically, use the IIS Node.js guide; do not apply that procedure to a Linux server.
This guide describes Next.js 14. For another major version, verify that version's deployment documentation before changing a working release.