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
Jasmin7mo 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
ericwaetke
ericwaetke7mo 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
Jasmin7mo 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
thetarnav7mo 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
ericwaetke
ericwaetke7mo 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
More Posts
Most concise upsert for store?I'm wondering if there was a more efficient way of doing an upsert operation? This is what I'm doingComputations created outside a render will never be disposed.Just wondering whether I can ignore this warning or if its potentially a problem. Basically I have Using Show with createRouteData / useRouteDatCurrently have a project setup with SolidStart, renderStream, and using createRouteData and useRoute1. arguments to useTransition() 2. measuring async updatesquicker one this time :) 1. looking at the official docs for useTransition: ``` import { useTransitiCan't run npm installHowdy y'all, I was trying to use the installer for solid start, and I chose the AuthJS option duringHow do we configure babel proposal decorators with Solid's vite plugin?I've got this Stackblitz: https://stackblitz.com/edit/solidjs-templates-wyjc1i?file=index.html,src%Can't build SolidStart after updating packagesAfter updating packages, I can't build project both locally and on vercel. I can't find anything relhow to trigger the fetcher in createResource if there are multiple signal values?hello, newbie here. In the document, it could be create a Memo as a group of signals as following. WNicest way of having computed properties in a store?I'm trying to model my store in a concise way, I want to have some base properties, and some computTypesafe way to render conditionally based on whether array has zero, one or many elements?Given an array with one or more elements, the idea is to display different UIs. With React, this can