Actually it is 2024 and I have same issue. for some reasons when I use hash router with baseName
its just a blank page with no errors
import { BrowserRouter, HashRouter } from "react-router-dom";
<HashRouter basename={import.meta.env.VITE_BASE_URL}>
<Suspense fallback={<div>Loading...</div>}>
<AppResolver />
</Suspense>
</HashRouter>
my vite config is next
export default defineConfig(({ mode }) => {
prefix.
const env = loadEnv(mode, process.cwd(), "");
return {
plugins: [
react(),
...
],
build: {
outDir: "./dist",
},
base: env.VITE_BASE_URL || "/",
};
});
and in package.json
file I have a string "homepage": "."
Which is all works with browser router but not hash.
I decided to try has router since GH pages not working great with SPA's. So I'm confused. any ideas, solutions how to run hasrouter on GH pages?