Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Latest commit

 

History

History
38 lines (27 loc) · 1.13 KB

2.static-hosting.md

File metadata and controls

38 lines (27 loc) · 1.13 KB

Static Hosting

There are two ways to deploy a Nuxt application to any static hosting services:

  • Static site generation (SSG) prerenders every route of your application at build time. For every page, Nuxt uses a crawler to generate a corresponding HTML and payload files.
  • Using ssr: false to produce a pure client-side output.

Prerendering

Use the nuxi generate command to build your application. The HTML files will be generated in the .output/public directory.

npx nuxi generate

Client-side Only Rendering

If you don't want to prerender your routes, another way of using static hosting is to set the ssr property to false in the nuxt.config file. The nuxi generate command will then output an index.html entrypoint like a classic client-side Vue.js application.

defineNuxtConfig({
  ssr: false
})

Advanced

You can manually specify routes that Nitro will fetch and prerender during the build.

defineNuxtConfig({
  nitro: {
    prerender: {
      routes: ['/user/1', '/user/2']
    }
  }
})