mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-12 07:17:13 +00:00
d567a91d7d
* docs: add link to hybrid rendering RFC * chore: update
43 lines
1.3 KiB
Markdown
43 lines
1.3 KiB
Markdown
# Static Hosting
|
|
|
|
::alert{type=warning icon=🚧}
|
|
This feature is still experimental and under development for Nuxt 3. [Full static](https://nuxtjs.org/announcements/going-full-static) is not yet implemented but will be in a near future.
|
|
::
|
|
|
|
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 file.
|
|
- Using `ssr: false` to produce a pure client-side output.
|
|
|
|
## Prerendering
|
|
|
|
Use the [`nuxi generate` command](/api/commands/generate) to build your application. The HTML files will be generated in the `.output/public` directory.
|
|
|
|
```bash
|
|
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 build` command will then output an `index.html` entrypoint like a classic client-side Vue.js application.
|
|
|
|
```ts [nuxt.config.ts|js]
|
|
defineNuxtConfig({
|
|
ssr: false
|
|
})
|
|
```
|
|
|
|
## Advanced
|
|
|
|
You can manually specify routes that [Nitro](/guide/concepts/server-engine) will fetch and prerender during the build.
|
|
|
|
```ts [nuxt.config.ts|js]
|
|
defineNuxtConfig({
|
|
nitro: {
|
|
prerender: {
|
|
routes: ['/user/1', '/user/2']
|
|
}
|
|
}
|
|
})
|
|
```
|