I have multiple projects set up in a monorepo. I load all of them and browse out to Shared to load the initial layout. However, when I click a link to go to a different zone/app Customer, I receive Loading chunk app/testing/page failed. (error: https://localhost:5206/_next/static/chunks/app/testing/page.js). Sure enough, opening development tools, it doesn't exist. I also have the same issue with my styling, and I believe the root cause is the same. However, if I refresh the page, everything works correctly.
I have my rewrites set up in my next.config.ts:
async rewrites() {
return [
{
source: '/customer/:path*',
destination: 'https://localhost:5216/:path*',
},
{
source: '/customer-static/_next/:path*',
destination: 'https://localhost:5216/_next/:path*',
},
...plus more
The url is simply: href: '/customer/testing'.
I notice when I refresh the page however, that the _next/static folder is now within my customer folder (as written in my rewrites). How can I fix this so that my correct css/js chunks load correctly without a refresh?