Next.js multi zones and shared components
I am using Next.js' multi zone feature with a blog and web app so I can develop and deploy both apps independently. It was easy to set up by following their example and I have set up a blog app at port
3000
and a web app at port 4200
, which is working fine. Unfortunately I am encountering some problems that aren't described anywhere in their documentation (as far as I can tell).
I am working in a monorepo and have shared components between both apps, such as the header and footer, which obviously includes navigation. When I am on the blog and want to navigate to e.g. the /about
page, then it will obviously navigate to localhost:3000/blog/about
instead of localhost:3000/about
. One solution is to check the base path in the navigation component and then prepend localhost:3000
to the href
if the base path equals blog
, but that refreshes the entire app and does not result in smooth navigation, so it's not really ideal. Is there anything else can I do about this?0 Replies