GitHub Pages

By pre-rendering our pages, we can remove the need for a Node.js server. We can then deploy our app to any static host, such as GitHub Pages.

We add an empty file .nojekyll to avoid GitHub Pages ignoring files starting with _ which breaks files such as

We recommend using the GitHub Pages Deploy Action, for example:

If we don't deploy our app at the URL root /, we can change our app's Base URL. E.g. we need to do this if we use GitHub Page's default deployment to*.

In general, we can choose between following deploy strategies:

  • We build locally and upload dist/client/ to the static host.
  • We let a GitHub action build and upload dist/client/ to the static host.
  • We let the static host run the build for us.

The build script $ vite build && vite build --ssr && vite-plugin-ssr prerender generates a directory dist/client/ that contains all our static assets.

We can then locally try our deploy with serve by running $ serve dist/client/.

Edit this page