Difference between targets when SSR is off


  • nuxt: v2.14.12
  • node: v14.15.0

What is the Issue?

Understand the difference in nuxt.config.js between

target: static
ssr: off


target: server,
ssr: off

The latter is something that doesn’t make sense semantically.
How can target be server if the ssr is off? anyway it does compile to an SPA

The former also compile to an SPA but from the network calls in chrome we can see there is one more file request so there seems to be a component split out

What is the real difference between the two combinations?


git clone https://github.com/laspinacristian/nuxt-targetStatic-noSsr
npm install
npm run generate
npm run start
git clone https://github.com/laspinacristian/nuxt-targetServer-noSsr
npm install
npm run build
npm run start

1 possible answer(s) on “Difference between targets when SSR is off

  1. ssr: false means that no server-side rendering itself is happening, no matter which target is set so the HTML will never contain actual content but only a few lines as well as the JS for the SPA to load.

    There are situations where it would still make sense to have a Node.js server running and “only” delivering an SPA: serverMiddleware would still work, modules like the proxy-module are enabled (and so on).
    Situations where those are mandatory but SSR is not needed are the only ones I can imagine when I’d choose target: 'server' + ssr: false.

    IIRC there shouldn’t be a difference when it comes to code-splitting though.

    I’d love to hear more comments on that (cc @pi0)