Skip to content

Commit

Permalink
fix: backward compat for server.preTransformRequests
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Jan 23, 2025
1 parent 3aa10b7 commit 5c35f99
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,16 @@ export async function resolveConfig(
configEnvironmentsSsr.dev.warmup = warmupOptions.ssrFiles
}

// Backward compatibility: server.preTransformRequests -> environment.dev.preTransformRequests
if (typeof config.server?.preTransformRequests !== 'undefined') {
configEnvironmentsClient.dev.preTransformRequests =
config.server?.preTransformRequests
configEnvironmentsSsr ??= {}
configEnvironmentsSsr.dev ??= {}
configEnvironmentsSsr.dev.preTransformRequests =
config.server?.preTransformRequests
}

// Backward compatibility: merge ssr into environments.ssr.config as defaults
if (configEnvironmentsSsr) {
configEnvironmentsSsr.optimizeDeps = mergeConfig(
Expand Down

0 comments on commit 5c35f99

Please sign in to comment.