nuxt.jsserver-side-renderingprerendernuxt3.js

Nuxt3 how to prerender all routes without any server side files


I'm trying to use nuxt3 to prerender my entire website, without having to rely on a server. I am looking to just get the html file alongside JS & css files.

However, even with this config, it still outputs server side files.

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  nitro: {
    prerender: { crawlLinks: true },
  },
})

Docs: https://nuxt.com/docs/getting-started/introduction


Solution

  • You will have to use npm run generate instead of npm run build. As simple as that.

    You can remove your crawlLinks config as crawling is defaulted with the generate command and it generates a full static site.