1

I'm working on a Nuxt universal app, but some parts of the app should be a SPA, so I'm using ssr: false in .vue pages.

What I don't understand is how do I treat those pages in production? Do I have to build them with npm run build? Currently I am using Nginx to render the Nuxt app.

kissu
  • 40,416
  • 14
  • 65
  • 133
JayK23
  • 287
  • 1
  • 15
  • 49

1 Answers1

1

What is your target property looking like? The default is server.

If target: server >> nuxt build
If target: static >> nuxt generate

More details here on all the differences: https://stackoverflow.com/a/63638062/8816585

On top of that, you can totally have a full static build but SPA render only some pages too thanks to exclude, more info here: https://stackoverflow.com/a/66472634/8816585

kissu
  • 40,416
  • 14
  • 65
  • 133
  • Thank you a lot! I did not set the target property yet, what are the difference between the two? And if i set it to 'server', i have to build the assets on each deploy? – JayK23 May 14 '21 at 10:16
  • The first link tells a lot between the differences of the two, the main question is essentially: `do I want to host it on a Node.js VPS server or as static on a CDN (like Netlify)?` It also depends of the type of content that may be used on your website. For example, if you have a login form right on the homepage, you will not be able to statically generate the content in advance (think about how this is not doable with Facebook for example) if it's password-locked and user-specific. In any case, you'll need to re-build/re-generate the assets if you do have any changes. – kissu May 14 '21 at 10:26
  • 1
    Thank you. I forgot to say that i'm not working on a static website but on a webapp that will have a lot of interactivity, so i think that 'target: server' is what i need. – JayK23 May 14 '21 at 10:34