v1.132.2 basePath is not working for browser url
Which project does this relate to?
Router
Describe the bug
Since that version, basepath has been replaced with the rewrite method, and it seems that the rewrite logic has been applied to basepath for backward compatibility with previous versions.
When basepath is configured the same way as in earlier versions, accessing without a basepath (e.g., http://localhost:3000) does not add the basepath to the browser URL.
Your Example Website or App
https://stackblitz.com/edit/github-lebazlff?file=src%2Froutes%2F__root.tsx
Steps to Reproduce the Bug or Issue
- check
window.location.pathnamein /home - click about
- check
window.location.pathnamein /about
Expected behavior
window.location.pathname in home should be /app
Screenshots or Videos
No response
Platform
- Router / Start Version: [e.g. 1.121.0]
- OS: [e.g. macOS, Windows, Linux]
- Browser: [e.g. Chrome, Safari, Firefox]
- Browser Version: [e.g. 91.1]
- Bundler: [e.g. vite]
- Bundler Version: [e.g. 7.0.0]
Additional context
No response
There are still issues in the newest version when using throw redirect: https://stackblitz.com/edit/github-m8qo8ju3?file=src%2Fmain.tsx
The "About" link includes the basepath but the beforeLoad redirect to /other (should be /basepath/other) omits it
@leesb971204 see the updated stackblitz apart from the bump in versions I added the base to the vite cconfig
@reihwald @leesb971204 I picked up some issues in the rewrite code path. @leesb971204 while it is still recommended to add the base in the vite config as this is where the application is mounted this also seems to resolve your issue.
@reihwald the fix also addresses your issue with the redirects, I've added an e2e test to this as well to ensure redirects with basePaths work as intended going forward.