Skip to content

Commit

Permalink
refactor: when discovery is disabled, bail during onCrawlEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
kherock committed Jul 25, 2023
1 parent da6ba09 commit c41fab1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/vite/src/node/optimizer/optimizer.ts
Expand Up @@ -220,8 +220,7 @@ async function createDepsOptimizer(
if (config.optimizeDeps.noDiscovery) {
// We don't need to scan for dependencies or wait for the static crawl to end
// Run the first optimization run immediately
const knownDeps = prepareKnownDeps()
optimizationResult = runOptimizeDeps(config, knownDeps)
runOptimizer()
} else if (!isBuild) {
// Important, the scanner is dev only
depsOptimizer.scanProcessing = new Promise((resolve) => {
Expand Down Expand Up @@ -626,7 +625,7 @@ async function createDepsOptimizer(
// It normally should be over by the time crawling of user code ended
await depsOptimizer.scanProcessing

if (!isBuild && optimizationResult) {
if (!isBuild && optimizationResult && !config.optimizeDeps.noDiscovery) {
const result = await optimizationResult.result
optimizationResult = undefined
currentlyProcessing = false
Expand Down

0 comments on commit c41fab1

Please sign in to comment.