NextJS - Issue routing between Multi Zones

Viewed 18

I have Multi Zone setup between two applications:

  • Home App
  • Blog App

When I am on a page within the Blog app and try to link back to the Home app, either using Link or router.push("/"), it takes me to the base path of the Blog app.

Inside the next.config.js, I've set it up as following:

/** @type {import('next').NextConfig} */

const withTM = require('next-transpile-modules')(['@workflow/shared-core']);

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  experimental: {
    externalDir: true
  },
  basePath: '/blog',
  rewrites: async () => {
    return [
      {
        source: "/",
        destination: "http://localhost:5001",
        basePath: false
      }
    ]
  }
}

module.exports = withTM(nextConfig)

My understanding was that when a rewrite is setup with the basePath set to false, it would fallback completely the URL in the destination property.

Any ideas?

0 Answers
Related