Skip to content

Commit 7c06ef0

Browse files
authored
refactor(optimizer): use early continues (#17551)
1 parent ff57d61 commit 7c06ef0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

packages/vite/src/node/optimizer/optimizer.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -790,17 +790,16 @@ function findInteropMismatches(
790790
const needsInteropMismatch = []
791791
for (const dep in discovered) {
792792
const discoveredDepInfo = discovered[dep]
793+
if (discoveredDepInfo.needsInterop === undefined) continue
794+
793795
const depInfo = optimized[dep]
794-
if (depInfo) {
795-
if (
796-
discoveredDepInfo.needsInterop !== undefined &&
797-
depInfo.needsInterop !== discoveredDepInfo.needsInterop
798-
) {
799-
// This only happens when a discovered dependency has mixed ESM and CJS syntax
800-
// and it hasn't been manually added to optimizeDeps.needsInterop
801-
needsInteropMismatch.push(dep)
802-
debug?.(colors.cyan(`✨ needsInterop mismatch detected for ${dep}`))
803-
}
796+
if (!depInfo) continue
797+
798+
if (depInfo.needsInterop !== discoveredDepInfo.needsInterop) {
799+
// This only happens when a discovered dependency has mixed ESM and CJS syntax
800+
// and it hasn't been manually added to optimizeDeps.needsInterop
801+
needsInteropMismatch.push(dep)
802+
debug?.(colors.cyan(`✨ needsInterop mismatch detected for ${dep}`))
804803
}
805804
}
806805
return needsInteropMismatch

0 commit comments

Comments
 (0)