From 811525c5c2464f082e2bbfc8d9201c6c48620518 Mon Sep 17 00:00:00 2001 From: baked Date: Wed, 3 May 2023 03:28:36 +0200 Subject: [PATCH] Fix basePath handling (#48) --- packages/runtime/src/router/ejected/body/branches/next.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/runtime/src/router/ejected/body/branches/next.ts b/packages/runtime/src/router/ejected/body/branches/next.ts index d20b433..1d5bab9 100644 --- a/packages/runtime/src/router/ejected/body/branches/next.ts +++ b/packages/runtime/src/router/ejected/body/branches/next.ts @@ -7,7 +7,7 @@ const renderNext = ({ internalPath, externalPath }: EjectedNextResponse) => (isDynamic(internalPath) ? ` next = (final_params) => - \`${internalPath + \`\${nextRequest.nextUrl.basePath || ""}${internalPath .replace(/\/(:[^/]*)/gm, (match, value) => { return match.replace(value, `\${final_params.${value.slice(1)}}`); }) @@ -20,7 +20,7 @@ next = (final_params) => ` : internalPath !== "//" && internalPath !== externalPath ? ` -next = "${internalPath}"; +next = \`\${nextRequest.nextUrl.basePath || ""}${internalPath}\`; ` : ` next = true;