From 8ddb49451b5096f6a630ad56c0f9ed9bb6bf68b4 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 28 Dec 2023 15:33:21 +0100 Subject: [PATCH] chore: always externalize vitest (#4816) --- packages/vitest/src/runtime/execute.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/vitest/src/runtime/execute.ts b/packages/vitest/src/runtime/execute.ts index cafc20eae700..be95df130652 100644 --- a/packages/vitest/src/runtime/execute.ts +++ b/packages/vitest/src/runtime/execute.ts @@ -63,6 +63,8 @@ export interface ContextExecutorOptions { state: WorkerGlobalState } +const bareVitestRegexp = /^@?vitest(\/|$)/ + export async function startVitestExecutor(options: ContextExecutorOptions) { // @ts-expect-error injected untyped global const state = (): WorkerGlobalState => globalThis.__vitest_worker__ || options.state @@ -109,6 +111,10 @@ export async function startVitestExecutor(options: ContextExecutorOptions) { externalizeMap.set(id, externalize) return { externalize } } + if (bareVitestRegexp.test(id)) { + externalizeMap.set(id, id) + return { externalize: id } + } return rpc().fetch(id, getTransformMode()) },