Skip to content

Commit

Permalink
fix: merge back client too
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 2, 2024
1 parent 0aae189 commit e686c7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vite/src/node/__tests__/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ test('ssr config compat', async () => {
expect(config.resolve.conditions).toMatchInlineSnapshot(`
[
"client1",
"client2",
]
`)
expect(config.environments.client.resolve.conditions).toMatchInlineSnapshot(`
Expand Down
5 changes: 5 additions & 0 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,11 @@ export async function resolveConfig(
config.ssr?.target === 'webworker',
)

// Backward compatibility: merge config.environments.client.resolve back into config.resolve
config.resolve ??= {}
config.resolve.conditions = config.environments.client.resolve?.conditions
config.resolve.mainFields = config.environments.client.resolve?.mainFields

const resolvedDefaultResolve = resolveResolveOptions(config.resolve, logger)

const resolvedEnvironments: Record<string, ResolvedEnvironmentOptions> = {}
Expand Down

0 comments on commit e686c7d

Please sign in to comment.