-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving from a pages router page to app directory through NextLink duplicates base path on built app #54770
Comments
Having this same issue. export async function GET() {
return new Response('Ok', {
status: 200,
});
} And this breaks some NextLink's in the legacy pages router which simply links to other legacy pages. Nothing links to the new If I just remove We use EDIT: My issue seems to be tied to Route handlers. As soon as I tried to just add a |
I'm having the same issue (using both |
I had this issue as well, although on direct router calls ( The extra basePath is applied here:
It was already added to the URL here:
|
I was looking at this again today and found #47486 , so far the suggested fix from crisvergara of setting |
I found bug about Link with basePath #66660 maybe this is related |
Verify canary release
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:19 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6020 Binaries: Node: 18.14.0 npm: 9.3.1 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 13.4.20-canary.12 eslint-config-next: 13.4.19 react: 18.2.0 react-dom: 18.2.0 typescript: 5.1.6 Next.js Config: output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
App Router, Routing (next/router, next/navigation, next/link)
Link to the code that reproduces this issue or a replay of the bug
https://github.com/Artsu/next-app-directory-with-legacy-pages-router
To Reproduce
npm install
npm run build
npm start
http://localhost:3000/demo
Pages example
link, this worksLanding page
link. The url is http://localhost:3000/demo but it opens http://localhost:3000/demo/demo insteadDescribe the Bug
In a project with set
basePath
that uses both app directory and legacy pages router, anynext/link
from legacy page to app directory page will have the correct route when hovered in browser but duplicates the base path when clicked. This only happens on built site runningnext start
or on exported static site. On development mode withnext dev
the issue does not occurExpected Behavior
After clicking the link users should be correctly directed to the app directory page with the basePath only getting added once
Which browser are you using? (if relevant)
Firefox 116.0.2 (64-bit)
How are you deploying your application? (if relevant)
next start, static s3
The text was updated successfully, but these errors were encountered: