if you set ssr: false
in nuxt.config.js
file, does this make nuxt work exactly same as plain Vue application?
if so, doing npm run build
, npm run start
will just serve static html/css/js file with node.js server?
Am I right here?
CodePudding user response:
From the nuxt3 document
ssr - Disables server-side rendering for sections of your app and make them SPA-only with ssr: false
What I understand from the doc
When SSR is false and use npm run build
If you make ssr: false
and build the project not generate, then It will work like a simple vue spa application. Like a traditional spa application, it will load the whole js in the initial load and then render in the client site.
When SSR is false and use npm run generate
Again if you make ssr: false
and generate the project not build, Then it will prerender all the pages and generate the static file. And it will work like a traditional static website. But you have to be careful that as SSR is false it will not prefetch any data it needs in the generated time. So It's best to generate pages with SSR mode on.
CodePudding user response:
Yeah, that will make Nuxt behave like Vue for the rendering part.
Be sure to have generate
for an SSG target and not build
(for SSR).
Here are more details of the benefits of still using Nuxt: https://stackoverflow.com/a/74714106/8816585