3

The way I understand is Server Side Rendering (SSR) is where the server renders the page and then sends chunks of data to the browser via one stream as opposed to the browser (client) loading the HTML page and then making the requests for all the JS/CSS etc.

This is the behaviour I would like to support for my webpage. But following their guide for Netlify, generates static HTML pages as normal with links to all the external dependencies?

In that case won't running npm run generate disable SSR? Or am I completely misunderstanding how this works?

3 Answers 3

5

Netlify is a static hosting service meaning that they don't support SSR, natively. I did reach out to them and they pointed me in the direction of using their functions to run an Express server.

An alternative to this if you want SSR without hassle is Heroku. Nuxt can also generate routes dynamically that you can then serve up to Netlify. The only downside is that if the information on your backend changes, you'd have to re run generate to fetch the new information.

Sign up to request clarification or add additional context in comments.

Comments

4

Edit 01/12/2021:

The original answer was to help anyone with Nuxt 2 and SSR on serverless platforms, but as of Nuxt 3 Beta, they have implemented SSR for Netlify: https://nuxt.com/deploy/netlify

Original Answer:

You can achieve it on Vercel with Vercel Builder for Nuxt. It adapts your project to use a serverless function and render your project with it. : https://github.com/nuxt/vercel-builder

Taken from the readme:

How it works

This Vercel builder takes a Nuxt application defined by a nuxt.config.js (or .ts) entrypoint and deploys it as a serverless function in a Vercel environment.

It features built-in caching of node_modules and the global yarn cache (even when dependencies change) and a multi-stage build for fast and small deployments.

4 Comments

A link to a potential solution is always welcome, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.
@AbhishekDutt Noted and thank you
Thanks for the alternative Ciril. I should note that as of Nuxt 3 (this question with Nuxt 2) Netlify now has support for Nuxt and SSR
Yes, you are right. I should have added this to my reply. It's a shame Netlify didn't implement something like this for Nuxt 2, since a lot of projects are still build with that. As of now Nuxt 3 is still in beta.
1

You can NOT Netlify is not for SSR, here with nuxt docs mention only static render.

BUT

in theory , you should use SSR with Function (serverless ) you need a lot of config to make it happen.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.