Skip to content

Commit

Permalink
chore: always externalize vitest (#4816)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Dec 28, 2023
1 parent 8f6225b commit 8ddb494
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vitest/src/runtime/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
},
Expand Down

0 comments on commit 8ddb494

Please sign in to comment.