DEV Community

Cover image for Nuxt build vs Nuxt Generate what is the difference?
Ismael Garcia
Ismael Garcia

Posted on

6 2 2 2 2

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

view raw socials.md hosted with ❤ by GitHub

Working on the audio version

The Loop VueJs Podcast

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay