S
SolidJS7mo ago
iNdra

Solidstart with CSR, SSR and SSG?

How to separately implement below methods in SolidStart project? I mean, I wonder how code is different below methods. Example: I saw "use server"; add to run SSR. Client-side rendering (CSR) Server-side rendering (SSR) Static site generation (SSG)
5 Replies
bigmistqke
bigmistqke7mo ago
"use server"; is not directly related to ssr. you can use it in a client side app too: it will then just be an rpc call to the server. you can enable/disable ssr in the app.config.(js|ts). ssg I actually don't know my guess is that it's defineConfig({ server: { presets: 'static' }})
iNdra
iNdraOP7mo ago
So Just use solidJS package is CSR and set SSR in config file will be SSR even when we use SolidJS package.
bigmistqke
bigmistqke7mo ago
no, I was talking about solid-start not solid-js. solid-start has an app.config.ts file: https://docs.solidjs.com/solid-start/reference/entrypoints/app-config
iNdra
iNdraOP7mo ago
I found the details. Thank you for support. Default ssr is ture in app.config.ts https://docs.solidjs.com/solid-start/reference/config/define-config when I change it, it is CSR. When set defineConfig({ server: { presets: 'static' }}) it will be SSG. crawlLinks: true will generate routes. https://docs.solidjs.com/solid-start/building-your-application/route-prerendering, https://nitro.unjs.io/config#prerender
bigmistqke
bigmistqke7mo ago
nice! didn't know about crawlLinks: true!
Want results from more Discord servers?
Add your server