From f15b4e99da1d8e5531ecc900792e3bb490fe1c7a Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 4 Jun 2024 17:26:17 +0200 Subject: [PATCH] fix(browser): don't optimize Vitest dependencies (#5843) --- packages/browser/src/node/index.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/packages/browser/src/node/index.ts b/packages/browser/src/node/index.ts index 96218c246053..a05e3392c7b0 100644 --- a/packages/browser/src/node/index.ts +++ b/packages/browser/src/node/index.ts @@ -191,13 +191,15 @@ export default (project: WorkspaceProject, base = '/'): Plugin[] => { 'vitest/browser', 'vitest/runners', '@vitest/utils', + '@vitest/runner', + '@vitest/spy', + '@vitest/utils/error', + '@vitest/snapshot', + '@vitest/expect', 'std-env', 'tinybench', 'tinyspy', 'pathe', - - // loupe is manually transformed - 'loupe', ], include: [ 'vitest > @vitest/utils > pretty-format', @@ -207,6 +209,7 @@ export default (project: WorkspaceProject, base = '/'): Plugin[] => { 'vitest > pretty-format > ansi-styles', 'vitest > pretty-format > ansi-regex', 'vitest > chai', + 'vitest > chai > loupe', 'vitest > @vitest/runner > p-limit', 'vitest > @vitest/utils > diff-sequences', '@vitest/browser > @testing-library/user-event', @@ -215,13 +218,6 @@ export default (project: WorkspaceProject, base = '/'): Plugin[] => { }, } }, - transform(code, id) { - if (id.includes('loupe/loupe.js')) { - const exportsList = ['custom', 'inspect', 'registerConstructor', 'registerStringTag'] - const codeAppend = exportsList.map(i => `export const ${i} = globalThis.loupe.${i}`).join('\n') - return `${code}\n${codeAppend}\nexport default globalThis.loupe` - } - }, async resolveId(id) { if (!/\?browserv=\w+$/.test(id)) return