#Remix + Vite + GitLab Pages

1 messages · Page 1 of 1 (latest)

lone briar
#

I want to host a Remix app on GitLab pages using Vite. Does anyone have experience with this? Is it even possible?

lone briar
bronze star
#

I think GitLab pages are restricted to serve “static” data, so JamStack style, generated at build time - frameworks like Astro and Gatsby do that. Remix explicitly and intentionally does NOT use that - the server is always needed.

lone briar
#

Noted - thanks @bronze star

random blade
#

You can probably do it with the unstable SPA remix vite mode. I seen someone build off GitHub pages recently, so I presume the same could work with gitlab.

glacial acorn
#

I'll share the link to that repo in a bit since I've seen someone else asking. Spoiler: I'm preparing a nice template for this with support for GH Pages and (Static) Netlify. I'm waiting for the remix Vite plugin basepath support PR to get merged to make it more generalized and then I'll release the template as well

glacial acorn
#

@lone briar the only tricky part to have in mind is that with a spa, you have to create an all routes rewrite to index.html (in case a user lands directly on a specific page and not the index, or if he hard refreshes the page).

Github Pages doesn't have support for that directly, that's why you can use a script to manually redirect from the 404 page and send the requested page url as a query param to index. And them manually massage the query param back into a url string that you can use the client router to redirect to - a bit consusing, I know.

GitLab Pages and Netlify support rewrites so you don't have to do that from a 404: https://docs.gitlab.com/ee/user/project/pages/redirects.html (what you want to use is /* / 200)

bronze star