Skip to content

Commit

Permalink
fix(browser): don't optimize Vitest dependencies (#5843)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va authored Jun 4, 2024
1 parent d5e51c4 commit f15b4e9
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/browser/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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
Expand Down

0 comments on commit f15b4e9

Please sign in to comment.