From 6260740d0b66a4cc122ef3b5fe0f9fb0d0a1fbc1 Mon Sep 17 00:00:00 2001 From: Ryan Christian <33403762+rschristian@users.noreply.github.com> Date: Fri, 28 Jun 2024 01:39:30 -0500 Subject: [PATCH] fix: `location.toString` in prerender (#131) --- src/prerender.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/prerender.ts b/src/prerender.ts index a37c00f..a84ae8f 100644 --- a/src/prerender.ts +++ b/src/prerender.ts @@ -345,7 +345,11 @@ export function PrerenderPlugin({ for (const i in u) { try { // @ts-ignore - globalThis.location[i] = String(u[i]); + globalThis.location[i] = + i === "toString" + ? u[i].bind(u) + : // @ts-ignore + String(u[i]); } catch {} }