Serve a statically generate Solid.js app to Github Pages
Hi, sorry if this is a trivial question but I literally cannot find an answer anywhere because it seems like everyone only focus on serving Solid Start app to all the hosting services.
After I tried to rund a vite build on my Solid.js web app, I received a dist folder.
Now, normally, I should be able to just commit that folder to Github and use it as the roots of the Github Pages and it would have been working just fine.
However, I just cannot get Github Pages to loads the assets (my css, js files) in the assets folder of the dist.
I am totally at a lost, can anyone who have managed to successfully hosted a Solid.js static app on Github pages provided me with a guide or something that I can follow?
Other framework have a Github Action that just allow us to deploy, but I cannot find one for Solid.js yet.
For context, I tried to open the index.html file form dist folder locally also but that still gives me an error relating to CORS policy.
At this point, I am just at a lost because I tried to do vite preview, it works just fine, so I know it has to be that I am missing something in my build process, and not because of the dist folder itself.
Can someone please give me your step by step on how you manage to host your Solid.js web app on Github Pages?
Thank you for those who read this and willing to help out
5 Replies
You can use the same action that we use to deploy solid-start apps: https://dev.to/lexlohr/using-solid-start-with-github-pages-3iok#create-a-github-action-to-deploy-the-page
Just make sure to change the folder to dist, because unlike solid-start, classic has no public directory.
DEV Community
Using Solid Start with GitHub pages
You may or may not yet have heard about Solid Start, which is the much anticipated upcoming meta...
Hi, thank you for responding I have tried the Github Action
But the problem is that I still have that same error where Github Pages could not access anything inside the assets folder
For some reason, when I access the website, it keeps refusing to fetch anything from the assets folder
Which has been keeping me from receiving my js and css file
Maybe you could help point me to an example public project that works?
ok I figure out the problem it is because I need specify the
in the vite.config file
For the router, yes.
Otherwise, it wouldn't matter.