#Remix + Vite + GitLab Pages
1 messages · Page 1 of 1 (latest)
Found this to be interesting...he's not using GL pages though: https://gitlab.com/janis/gl-remix-cloudflare/-/tree/main?ref_type=heads
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.
Noted - thanks @bronze star
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 's repo https://discord.com/channels/770287896669978684/1198363828841361458
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
@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)
oh yeah, forgot about SPA mode, sorry for the confusion. it might actually be possible, although it should be noted you can't use dynamic server functionalities in Remix that way. your app effectively becomes a SPA - functionally eqiuvalent to using a create-vite app with react router, but a bit nicer around the edges