Skip to content

Commit

Permalink
fix: fix import chain walking
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 26, 2020
1 parent e2594df commit 9a44248
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/node/server/serverPluginHmr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ function walkImportChain(
return false
}

let hasDeadEnd = false
for (const importer of importers) {
if (importer.endsWith('.vue') || isHmrAccepted(importer, importee)) {
// vue boundaries are considered dirty for the reload
Expand All @@ -230,19 +229,21 @@ function walkImportChain(
} else {
const parentImpoters = importerMap.get(importer)
if (!parentImpoters) {
hasDeadEnd = true
} else {
hasDeadEnd = walkImportChain(
return true
} else if (
walkImportChain(
importer,
parentImpoters,
hmrBoundaries,
dirtyFiles,
currentChain.concat(importer)
)
) {
return true
}
}
}
return hasDeadEnd
return false
}

function isHmrAccepted(importer: string, dep: string): boolean {
Expand Down

0 comments on commit 9a44248

Please sign in to comment.