Can we use Nuxt as SPA only?
Asked Answered
V

1

5

I am currently using Angular + nodejs as my main tech stack...
I am interested in Vue, had a few simple projects with that, and saw a few videos about Nuxt3. Does Nuxt3 support SPA applications (with nodejs API), or not?
If not, will it support SPA in the future?

Victoriavictorian answered 12/10, 2022 at 8:16 Comment(0)
D
10

Nuxt is a super set of Vue, meaning that it can do everything that Vue does but will add more capabilities on top of it.

As shown here, you can totally use Nuxt3 as an SPA by adding the following to the nuxt.config.js file

defineNuxtConfig({
  ssr: false
})

Still, I recommend using at least SSG or SSR to get some SEO/rendering benefits.

Dink answered 12/10, 2022 at 15:37 Comment(3)
But what command do you need for creating the spa? $ npm run generate or $ npm run build?Zeba
@Zeba build is for an SSR app, since SPA can be fully static you don't need a server to render it on demand. The good one to use is generate (it will build it at build-time when pushing your code).Dink
But the generate command will generate all pages file to html, this is more like SSG than SPA. With SPA mode, we only need 01 file index.html, not all route pages.Theorbo

© 2022 - 2024 — McMap. All rights reserved.