Support static deployments with `ssr: false`
See original GitHub issueDisabling 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.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:15 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
andnpm 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!
Since the Service Worker presets work as expected, we need to
ssr: false
warn user and point to docs