Skip to content

Commit

Permalink
refactor: reverse the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Feb 16, 2024
1 parent 7623581 commit 2ca701f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/vitest/src/node/plugins/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { searchForWorkspaceRoot } from 'vite'
import { searchForWorkspaceRoot, version as viteVersion } from 'vite'
import type { DepOptimizationOptions, ResolvedConfig, UserConfig as ViteConfig } from 'vite'
import { dirname } from 'pathe'
import type { DepsOptimizationOptions, InlineConfig } from '../../types'
Expand Down Expand Up @@ -45,6 +45,14 @@ export function resolveOptimizerConfig(_testOptions: DepsOptimizationOptions | u
exclude,
include,
}

// `optimizeDeps.disabled` is deprecated since v5.1.0-beta.1
// https://github.com/vitejs/vite/pull/15184
// but explicit `disabled: false` is needed for SSR on v5.0
// https://github.com/vitejs/vite/discussions/13839#discussioncomment-8078714
const [major, minor] = viteVersion.split('.').map(Number)
if (major >= 5 && minor < 1)
newConfig.optimizeDeps.disabled = false
}

return newConfig
Expand Down

0 comments on commit 2ca701f

Please sign in to comment.