Skip to content

Commit

Permalink
fix: only add guard during build
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Jun 24, 2022
1 parent 09e7beb commit 15a6e53
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/vite/src/node/optimizer/optimizer.ts
Expand Up @@ -530,11 +530,13 @@ export async function initDepsOptimizer(
// If all the inputs are dependencies, we aren't going to get any
// delayDepsOptimizerUntil(id) calls. We need to guard against this
// by forcing a rerun if no deps have been registered
setTimeout(() => {
if (!firstRunCalled && registeredIds.length === 0) {
getDepsOptimizer(config)?.run()
}
}, runOptimizerIfIdleAfterMs)
if (isBuild) {
setTimeout(() => {
if (!firstRunCalled && registeredIds.length === 0) {
getDepsOptimizer(config)?.run()
}
}, runOptimizerIfIdleAfterMs)
}
}

function registerWorkersSource(id: string): void {
Expand Down

0 comments on commit 15a6e53

Please sign in to comment.