Skip to content

Commit

Permalink
fix: backcompat merging
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Apr 26, 2024
1 parent 62921e6 commit 294a84e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,11 @@ export async function resolveConfig(
// TODO: should entries and force be in EnvironmentOptions?
const { entries, force, ...deprecatedClientOptimizeDepsConfig } =
config.optimizeDeps ?? {}
let configEnvironmentsClient = config.environments!.client!
const configEnvironmentsClient = config.environments!.client!
configEnvironmentsClient.dev ??= {}
configEnvironmentsClient.dev.optimizeDeps = mergeConfig(
configEnvironmentsClient.dev.optimizeDeps ?? {},
deprecatedClientOptimizeDepsConfig,
configEnvironmentsClient.dev.optimizeDeps ?? {},
)

const deprecatedSsrOptimizeDepsConfig = config.ssr?.optimizeDeps ?? {}
Expand All @@ -885,8 +885,8 @@ export async function resolveConfig(
if (configEnvironmentsSsr) {
configEnvironmentsSsr.dev ??= {}
configEnvironmentsSsr.dev.optimizeDeps = mergeConfig(
configEnvironmentsSsr.dev.optimizeDeps ?? {},
deprecatedSsrOptimizeDepsConfig,
configEnvironmentsSsr.dev.optimizeDeps ?? {},
)
// TODO: should we merge here?
configEnvironmentsSsr.resolve ??= {}
Expand Down Expand Up @@ -946,10 +946,10 @@ export async function resolveConfig(
)

// Backward compatibility: merge environments.client.dev.optimizeDeps back into optimizeDeps
configEnvironmentsClient = resolvedEnvironments.client
const resolvedConfigEnvironmentsClient = resolvedEnvironments.client
const patchedOptimizeDeps = mergeConfig(
configEnvironmentsClient.dev?.optimizeDeps ?? {},
config.optimizeDeps ?? {},
resolvedConfigEnvironmentsClient.dev?.optimizeDeps ?? {},
)
const backwardCompatibleOptimizeDeps = {
holdUntilCrawlEnd: true,
Expand Down

0 comments on commit 294a84e

Please sign in to comment.