From 31ddf89f5465a02647196b981d859f66fae576ca Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 6 May 2022 04:07:48 -0500 Subject: [PATCH] fix: vite plugin should not load for vite cache --- src/integration/api.md | 2 ++ src/utils/vite.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/integration/api.md b/src/integration/api.md index 6c611911..c2891e22 100644 --- a/src/integration/api.md +++ b/src/integration/api.md @@ -32,6 +32,8 @@ export interface PartytownConfig { logSendBeaconRequests?: boolean; logSetters?: boolean; logStackTraces?: boolean; + // (undocumented) + mainWindowAccessors?: string[]; resolveUrl?(url: URL, location: Location): URL | undefined | null; // (undocumented) set?: SetHook; diff --git a/src/utils/vite.ts b/src/utils/vite.ts index 0d320c30..bcc1bee7 100644 --- a/src/utils/vite.ts +++ b/src/utils/vite.ts @@ -32,7 +32,7 @@ export function partytownVite(opts: PartytownViteOptions) { const url = req.url ?? ''; // drop query const [pathname] = url.split('?'); - if (pathname.includes('partytown')) { + if (pathname.includes('partytown') && !pathname.includes('.vite')) { const fileName = pathname.split('/').pop(); if (fileName && fileName.endsWith('.js')) { const libDir = libDirPath({ debugDir: pathname.includes('/debug/') });