S
SolidJS14mo ago
Eric

Generating Client Only code for static deployment

Hey people, I’m trying to build my solid start app for client use only. We’ve got an ordinary, no bells and whistles, webspace. And my goal is to deploy the solid start app to there. However, I’m not quite sure how to do that. Both when building with the default adapter and SSR turned off, and with the solid-start-static adapter, I only get "server" code. Also, it confuses me that SSR needs to be turned on for solid start static? I guess that makes sense because it needs to be rendered on the server in order to generate the static files. I don’t even know if I need a static export? There is quite a lot of code expected to run at runtime, and not a lot of static elements. Btw, it was already surprisingly difficult to figure out there even is solid-start-static, and 2) to find it, as in the docs it’s only referred to as »Static Hosting« Do you guys have recommendations on what to do?
5 Replies
Jasmin
Jasmin14mo ago
I'm not sure if "fully static", like astro for example, is possible with solid start. Is using solidjs without solid-start not an option for you? This would produce a client app only, without any server. if I remember correctly, using ssr: false still needs a server to generate the html scaffolding. yes, ryan wrote this the other day: https://discord.com/channels/722131463138705510/910635844119982080/1172253832642838598
Eric
EricOP14mo ago
Well the thing is, I need stuff like useSearchParams, which afaik is not in solidjs w/o start? And I also don’t want fully static, as it basically is a client only app, but with some routing features, such as searchparams as I said
Jasmin
Jasmin14mo ago
useSearchParams is from the solid router https://github.com/solidjs/solid-router?tab=readme-ov-file#usesearchparams yes for this I suggest just using solidjs with the router :) the solid router is independent of solid-start
thetarnav
thetarnav14mo ago
do you want to generate html files for each page, or have a fully csr app? if you turn off the srr it still will produce server.js, but client-side-only bundle will be available in /dist/public I think and to generate html files for each page, the ssr needs to be enabled, and you need to pass an array of all urls that need to be generated: https://github.com/solidjs-community/solid-primitives/blob/main/site/vite.config.ts#L28-L31 and you still use /dist/public for deployment
Eric
EricOP14mo ago
omg! I think I just assumed that in the public folder is the same as in my normal public folder that’s really exactly what I needed, thanks so much!
Want results from more Discord servers?
Add your server