DEV Community

Cover image for Deploy a solid-start app on github pages

Deploy a solid-start app on github pages

Alex Lohr on January 11, 2024

Solid-start is the long awaited meta-framework for Solid.js. Since it entered its second beta after a rewrite, there were a few breaking changes, s...
Collapse
 
vguleaev profile image
Vladislav Guleaev • Edited

as far as I know github pages is static hosting, if you plan to use SolidJs its fine, but how can you deploy solid-start? You need a running server for this? Where do you exactly deploy?

Thats why i believe whole your Solid app was just prerendered, if you have any (loader, getInitialProps alternative in Solid) it will not be updated, but cached forever until next build

Collapse
 
lexlohr profile image
Alex Lohr

Obviously, you can only deploy the static pages that you create using solid-start. This means you can use internal APIs only as long as the answers are present during the build (and you won't get any updates unless you re-deploy). Using external APIs (mind the CORS headers) works fine.

Collapse
 
amustafa16421 profile image
Mustafa_A

intresting.

waiting for more on this :-)

Collapse
 
efpage profile image
Eckehard

"...up to two minutes" sound a bit annoying during development. Is there any "fast track preview" like we have in vite?

Collapse
 
lexlohr profile image
Alex Lohr • Edited

This only applies to the first initialization for the GitHub pages. The action usually runs within a few seconds after pushing or merging to master. I should probably add a few words of clarification there

Also, solid-start supports a dev server that runs within milliseconds and has hot module reloading, too. This is only the time that deployment on GitHub pages takes.

Collapse
 
christiankouts profile image
Christian-Kouts • Edited

San you please show this process on a real static site via a YouTube video😓

Collapse
 
lexlohr profile image
Alex Lohr

Sorry, I'm mostly about text. If you want, you can find me as @lexLohr on discord; ping me and I'll help you there with your current project.

Collapse
 
madhumitha13579 profile image
madhumitha13579 • Edited

Hi, I have a doubt. Can we use npm run build command also to take build right?

Collapse
 
lexlohr profile image
Alex Lohr

I do. You'll see it in the workflow.

Collapse
 
madhumitha13579 profile image
madhumitha13579

Ok. Thanks for reply. Why I asked because for solid app, after taking build dist file was created. But in solid start, .output and vinxi files were created. So that I'm confused. Can you tell me please why two files were created?

Thread Thread
 
lexlohr profile image
Alex Lohr

solid-start creates the files to start a server temporarily that is used to render the static pages.

Thread Thread
 
madhumitha13579 profile image
madhumitha13579

ok

Collapse
 
carter907 profile image
Carter

Please make an updated version

Collapse
 
blankeos profile image
Carlo Taleon

Yup, this works. Thanks buddy! I think the vite baseUrl and solid router baseUrl did the trick. How did you know how to do this? I can't find anything about it on the docs.

Collapse
 
amustafa16421 profile image
Mustafa_A

trade secrcet ;-) :-p
( joking obviously )

Collapse
 
lexlohr profile image
Alex Lohr

A lot of trial and error.