rafgraph / spa-github-pages

Host single page apps with GitHub Pages
https://spa-github-pages.rafgraph.dev
MIT License
3.83k stars 565 forks source link

React-router params #58

Open keyofevergreen opened 2 years ago

keyofevergreen commented 2 years ago

Hello! I keep id in router params. And when the page is reloaded, a request is made to the server for this id

But for some reason, nothing happens to me instead and it seems that the whole application crashes (white screen, 404 errors in the console)

I don't understand what's wrong. Didn't find a solution..

Jasperhino commented 2 years ago

I have the same problem using React BrowserRouter with useParams(). Did anyone find a solution for this yet?

Jasperhino commented 2 years ago

I just solved it, the problem was, that the app was looking for owner.github.io/assets/index.js instead of owner.github.io/repo/assets/index.js. I solved this by adding base: '/repo/' in my vite.config.js.