Should storybook/nextjs respect next.config.js basePath when rendering next/link? #31384
vietanhtran16
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
Recently we found a bug in our application where we are using next/link for external links outside of our applications. This caused issue as the next/link appends the basePath to our url which makes it an invalid url. For example,
basePath
is/app/example
and we have<Link href="/app/blah" />
which would result in/app/example/app/blah
.I am fully aware that this is incorrect usage of next/link as that should only be routing to another nextjs route in the same application but it would have been helpful if
next/link
is rendered with the basePath in storybook as our assertions on the link would have caught the issue - essentially behaves the same as the app would in production.This would be super helpful in valuable as we use storybook for most of our development so having it behaves as if it was production would be super beneficial
Describe the solution you'd like
Based on the documentation, I assume that storybook nextjs already relies on
next.config.js
so it should be able to readbasePath
and ensure that next/link as well as next/router is aware of thisbasePath
Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
no
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions