Skip to content

Commit

Permalink
fix(vite): avoid hanging warning timer (#2359)
Browse files Browse the repository at this point in the history
  • Loading branch information
justmoon committed Mar 18, 2023
1 parent 9b98b49 commit 8554bf4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/vite/src/modes/global/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ export function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedMo
}
}

function clearWarnTimer() {
if (resolvedWarnTimer) {
clearTimeout(resolvedWarnTimer)
resolvedWarnTimer = undefined
}
}

onInvalidate(() => {
invalidate(10, new Set([...entries, ...affectedModules]))
})
Expand Down Expand Up @@ -143,6 +150,7 @@ export function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedMo
const entry = resolveId(id)
if (entry) {
resolved = true
clearWarnTimer()
entries.add(entry)
return entry
}
Expand All @@ -159,6 +167,9 @@ export function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedMo
map: { mappings: '' },
}
},
closeBundle() {
clearWarnTimer()
},
},
{
name: 'unocss:global:post',
Expand Down

0 comments on commit 8554bf4

Please sign in to comment.