question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support static deployments with `ssr: false`

See original GitHub issue

Disabling SSR limits the ability to prefetch query endpoints in the generation process and therefore generated website will not contain any content.

There are some approaches we can take to support non-ssr websites:

  • We can ship nitro into service workers to handle API requests for content APIs and provides content live in production.

  • Like Content v1 we can expose the whole database to the client using /api/_content/cache API (pre-rendered) and search and provide content live in the client.

\cc @pi0 @Atinux @Tahul

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:15 (10 by maintainers)

github_iconTop GitHub Comments

7reactions
jshimkoskicommented, Jun 8, 2022

First things first, I want to thank the Nuxt Content team for all of your hard work. You all are amazing developers.

That said, I’ve run into this issue as well.

Being able to generate a static distribution of a Nuxt Content v2 site is crucial functionality and the ability to do this was a huge selling point of v1.

Requiring a Nodejs server in order to run a Nuxt Content v2 site is not only crippling, but it makes the development vs production flow a nightmare.

For example, I have a fully functional (in development) version of an application rewritten for Nuxt Content v2 but it cannot be deployed in the same manner as its v1 counterpart because it blows up with a “You should use slots with <ContentRenderer>” error after running npm run generate and npm run preview then visiting it in a browser.

For users without access to a Nodejs server, a static hosting solution is vital. I was actually shocked that this functionality wasn’t baked into the stable release (especially after migrating everything over to v2, just to find out later that SSG doesn’t currently work).

I hoping this issue can be resolved in the near future.

Thanks!

1reaction
farnabazcommented, Jul 11, 2022

Since the Service Worker presets work as expected, we need to

  • Update documentation, and add notes about SPAs. There are two options,
    • Use Nitro’s Service Worker preset
    • Pre-render pages and create a static website
  • Detect ssr: false warn user and point to docs
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Disable Server-Side Rendering (SSR) in Next.js
We want to deploy our app as a static bundle that can be served without a Node.js server. For this, Next.js offers the...
Read more >
Demystify Nuxtʼs Target, Mode, and Ssr Properties | Kontent.ai.
The ssr: 'false' is a counterpart of the deprecated mode: 'spa' and cannot be used with target: 'static' . Also, there are several...
Read more >
Nuxt Server, Nuxt Static, SSR true or false - YouTube
Ever wonder which one you should use? Server or static ? When to use static and what benefits it brings. What about SSR,...
Read more >
Nuxt - how does ssr: false work in production in Universal ...
What is your target property looking like? The default is server . If target: server >> nuxt build. If target: static >> nuxt...
Read more >
Using Non-SSR Friendly Components with Next.js
Next.js claims to support ES2020 dynamic import() for JavaScript. ... You can use the ssr: false object to disable server-side rendering of your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found