Skip to content

Commit

Permalink
fix(optimizer): define crawlDeps after scanProcessing and optimizatio…
Browse files Browse the repository at this point in the history
…nResult are complete (fix #14284) (#14285)
  • Loading branch information
anyesu authored and bluwy committed Oct 3, 2023
1 parent 40e99a1 commit fcaf749
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/optimizer/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,6 @@ async function createDepsOptimizer(
return
}

const crawlDeps = Object.keys(metadata.discovered)

// Await for the scan+optimize step running in the background
// It normally should be over by the time crawling of user code ended
await depsOptimizer.scanProcessing
Expand All @@ -630,6 +628,7 @@ async function createDepsOptimizer(
optimizationResult = undefined
currentlyProcessing = false

const crawlDeps = Object.keys(metadata.discovered)
const scanDeps = Object.keys(result.metadata.optimized)

if (scanDeps.length === 0 && crawlDeps.length === 0) {
Expand Down Expand Up @@ -680,6 +679,7 @@ async function createDepsOptimizer(
runOptimizer(result)
}
} else {
const crawlDeps = Object.keys(metadata.discovered)
currentlyProcessing = false

if (crawlDeps.length === 0) {
Expand Down

0 comments on commit fcaf749

Please sign in to comment.