Prerendering Nuxt without accidentally shipping a server

#nuxt#static#ci

The failure mode is quiet. nuxi generate exits zero, the deploy succeeds, and the site works. Months later you notice the host is invoking a function on every request, because the preset emitted a server rather than a directory of HTML.

Check the output, not the log

The only reliable check is the filesystem:

find .output/public -name "index.html" | sort

Every route in the site map should appear. If a route is missing, it is being rendered on demand.

Fail the build instead

Prerender errors should stop the pipeline rather than degrade quietly:

nitro: {
  prerender: {
    crawlLinks: true,
    failOnError: true
  }
}

failOnError is the important half. Without it a route that throws during prerender is skipped and the deploy proceeds with a hole in it.