Skip to content

Commit 5ef557a

Browse files
authored
fix: fix external: true merging (#21164)
1 parent 74559c9 commit 5ef557a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

packages/vite/src/node/__tests__/config.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,24 @@ describe('mergeConfig', () => {
166166
})
167167

168168
test('handles ssr.noExternal', () => {
169-
const baseConfig = {
169+
const baseConfig: UserConfig = {
170170
ssr: {
171171
noExternal: true,
172+
external: true,
172173
},
173174
}
174175

175-
const newConfig = {
176+
const newConfig: UserConfig = {
176177
ssr: {
177178
noExternal: ['foo'],
179+
external: ['bar'],
178180
},
179181
}
180182

181-
const mergedConfig = {
183+
const mergedConfig: UserConfig = {
182184
ssr: {
183185
noExternal: true,
186+
external: true,
184187
},
185188
}
186189

packages/vite/src/node/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ function mergeConfigRecursively(
12601260
merged[key] = [].concat(existing, value)
12611261
continue
12621262
} else if (
1263-
((key === 'noExternal' &&
1263+
(((key === 'noExternal' || key === 'external') &&
12641264
(rootPath === 'ssr' || rootPath === 'resolve')) ||
12651265
(key === 'allowedHosts' && rootPath === 'server')) &&
12661266
(existing === true || value === true)

0 commit comments

Comments
 (0)