Skip to content

Commit

Permalink
fix(optimizer): trigger onCrawlEnd after manual included deps are reg…
Browse files Browse the repository at this point in the history
…istered (vitejs#18733)
  • Loading branch information
sapphi-red authored Nov 22, 2024
1 parent ed99a2c commit dc60410
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/optimizer/optimizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export function createDepsOptimizer(
cachedMetadata || initDepsOptimizerMetadata(environment, sessionTimestamp)

if (!cachedMetadata) {
environment.waitForRequestsIdle().then(onCrawlEnd)
waitingForCrawlEnd = true

// Enter processing state until crawl of static imports ends
Expand All @@ -187,6 +186,8 @@ export function createDepsOptimizer(
newDepsDiscovered = true
}

environment.waitForRequestsIdle().then(onCrawlEnd)

if (noDiscovery) {
// We don't need to scan for dependencies or wait for the static crawl to end
// Run the first optimization run immediately
Expand Down

0 comments on commit dc60410

Please sign in to comment.