Routes not working in production
See original GitHub issueHi, I have really liked this seed project. However when I run the command npm run build
everything works fine and I see the complied result in dist folder. I have added couple of new routes, views and components. After the compilation is done. When I try running the files from the dist folder I only see the Home page, when I try navigating to other pages it gives a 404 error.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
react-router does not work in production and surge deployments
In dev mode all things works great but when i switched to the production build there was some routing issues in my react...
Read more >Handling React Routing in Production - Pluralsight
This guide shows how to solve a page not found error you've in a React app that uses React Router or the HTML5...
Read more >React router page links not working in production : r/reactjs
Hey everyone. So I have a react site where I use react router to link to different pages. It works locally, but when...
Read more >React Router not Working in Production - DEV Community
When I put the website live on a server, I'm not able to type the URL in the browser. If I do so,...
Read more >Why is React Router not working in production? - Quora
React Router is not working in production. ... the routes exists in the code that is running on the browser, but the routes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@egoist got it I found some info here: https://router.vuejs.org/en/essentials/history-mode.html
thanks for pointing that out @zeeshanjan82 ! For others that may run into the issue, the
https://github.com/bripkens/connect-history-api-fallback
does the trick or you can also manually set a catch-all route and redirect to index for vue router to parse. This is how it could be implemented in express:serving static build through root (*using
serve-static
npm)manual catch-all
PS. for newbies, remember to do a
npm run build
prior to depoyment to include the latest changes !