Build Vite app in GitHub Pages routes system

Viewed 55

I'm building a website with solidjs and vite, and I'm planning to deploy it to GitHub-Pages which has the routes and files based on the repository, so if I want a route in /about/ I have to create a folder named about, and have a index.html file in it, like so: (expected output)

/
├── index.html (home page)
└── about/
    └── index.html (about page)

But vite in the default configuration outputs a single html file for everything. I have looked into the vite documentation and haven't found anything related.

Vite Configuration:

import { defineConfig } from 'vite'; 
import solidPlugin from 'vite-plugin-solid'; 
  
export default defineConfig({ 
  plugins: [solidPlugin()], 
  server: { 
    port: 3000, 
  }, 
  build: { 
    target: 'esnext', 
  }, 
});

Current output:

/
├── dist/
│   ├── assets/
│   │   ├── index.css
│   │   └── index.js
│   └── index.html
├── src/
│   └── ...
└── ...

How do I change the configuration so that the output is in GitHub Pages routing format?

0 Answers
Related