Routing broken for preview with react-router-dom in 4.0.0-alpha.2
See original GitHub issueDescribe the bug
When going to /some/route/somewhere
using react-router-dom with preview the query path is not passed to the route leading to a 404 error.
In local dev it works fine.
git bisect
indicates this PR is the cause:
https://github.com/vitejs/vite/pull/10475
Reproduction
Steps to reproduce
note: the StackBlitz link will run a build then run preview from the terminal query param. In dev the problem does not appear to happen.
Go to /test/about
in the StackBlitz repro:
System Info
n/a
Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:9
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Routing broken for preview with react-router-dom in 4.0.0 ...
Describe the bug When going to /some/route/somewhere using react-router-dom with preview the query path is not passed to the route leading to a...
Read more >Nested routing is not working in React Router dom V4 from ...
I am trying to implement nested routing in my React app, but 'Route' only works when used in App.js and doesnot works when...
Read more >React Router v6 Preview
react-router-dom @6.0.0-alpha.2 reveals the total bundle size decreased by 70%. Smaller bundles means your app loads more quickly, especially ...
Read more >React Router v6 Preview: Nested Routing (TUTORIAL)
View the code on GitHub: https://github.com/samselikoff/2020-06-09-react- router -v6-navlink.
Read more >Getting started with React Router v4 - Pusher Blog
You can open http://localhost:3000 to preview it in the browser. Next, we need to install React Router. In version 4, the library was...
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 Free
Top 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
I can confirm this error in vite 4.0.0 (stable) as well. In dev everything works fine, but as soon as I run
yarn preview
refreshing a nested route it breaks, e.g.http://localhost:3000/user
but navigating fromhttp://localhost:3000/
tohttp://localhost:3000/user
via link works fineI just installed v4.0.1 and my problem has been solved. Awesome job guys and thank you!