Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(optimizer): define crawlDeps after scanProcessing and optimizationResult are complete (fix #14284) #14285

Merged
merged 1 commit into from Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vite/src/node/optimizer/optimizer.ts
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