Nuxt build vs Nuxt Generate what is the difference?

What is the difference ?

In the nuxt docs for Cloudflare deployment (https://nuxt.com/deploy/cloudflare), it mentions two options of nuxt build or nuxt generate. It says:

“To leverage server-side rendering on the edge, set the build command to: nuxt build
vs
To statically generate your website, set the build command to: nuxt generate”

What are the pros and cons to each approach here?
Is it as simple as SSR vs SPA?
Will it matter if for example I choose nuxt build for SSR but have areas in my app that are [ClientOnly] ?

Simple answer:

Nuxt generate creates static files that can be served statically on a CDN, without the need for a server running an application process
“generate” runs through the static-site-generation (SSG) process and outputs static html/css/js files. There is no running server with this option.

Nuxt build creates a node app that requires a server to run.
***”build” creates a server that runs and processes every request

Note

It’s confusing because Cloudflare pages used to be for static hosting only. Now it supports SSR too. Just connect your repo via Cloudflare pages and it will take care of the rest for you

nuxt-monorepo-layers

Please if anyone have a better way please comment below and let’s learn together

Working on the audio version

The Loop VueJs Podcast


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top
Please set api key.