Deployment Targets
Static Hosting
Nuxt also works as a static site generator. Statically render your Nuxt application and get all of the benefits of a universal app without a server. The nuxt generate command will generate a static version of your website. It will generate HTML for every one of your routes and put it inside of its own file in the dist/ directory. This improves performance as well as SEO and better offline support.
For static sites the target of static needs to be added to your nuxt.config file.
export default {
target: 'static' // default is 'server'
}
Running nuxt dev with the static target will improve the developer experience:
-
Remove
req&resfromcontext - Fallback to client-side rendering on 404, errors and redirects see SPA fallback
-
$route.querywill always be equal to{}on server-side rendering -
process.staticis true
process.target for module authors to add logic depending on the user target.Server Hosting
Server hosting means running Nuxt on a Node.js server. When the user opens your page, their browser will request that page from the server. Nuxt will handle the request, render the page and send back the resulting page with all its content.
You might need server hosting if you want to render HTML on each request rather than in advance at generate-time, or if you need serverMiddleware .
ssr: false but Nuxt will not fully render the HTML for each page - leaving that task to the browser. You might choose this option if you need serverMiddleware but do not want fully server-side rendered HTML.For server hosting, target: 'server' is used, which is the default value. You will use the build command to build your application.
export default {
target: 'server'
}
Leoš Literák
Trizotti
Clément Ollivier
Sébastien Chopin
Marcello Bachechi
Rodolphe
Thomas Underwood
Shek Evgeniy
felipesuri
Lukasz Formela
Hugo Torzuoli
Sylvain Marroufin
Kareem Dabbeet
tramplay
Daniel Roe
verebelyicsaba
Adam
Nate Butler
Sandra Rodgers
Arpit Patidar
Matthew Kuehn
Steven DUBOIS
Travis Lindsey
syagawa
Maxime
かる
Al Power
Florent Delerue
quanghm
José Manuel Casani Guerra
Unai Mengual
kazuya kawaguchi
Michael Lynch
Tomachi
pooya parsa
Meir Roth
Brett
Adam Miedema
Thomas Bnt
Kazuki Furukawa
Anthony Ruelle
Christophe Carvalho Vilas-Boas
Roman Harmyder