Skip to content

Commit 8554bf4

Browse files
authored
fix(vite): avoid hanging warning timer (unocss#2359)
1 parent 9b98b49 commit 8554bf4

File tree

1 file changed

+11
-0
lines changed
  • packages/vite/src/modes/global

1 file changed

+11
-0
lines changed

packages/vite/src/modes/global/dev.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ export function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedMo
104104
}
105105
}
106106

107+
function clearWarnTimer() {
108+
if (resolvedWarnTimer) {
109+
clearTimeout(resolvedWarnTimer)
110+
resolvedWarnTimer = undefined
111+
}
112+
}
113+
107114
onInvalidate(() => {
108115
invalidate(10, new Set([...entries, ...affectedModules]))
109116
})
@@ -143,6 +150,7 @@ export function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedMo
143150
const entry = resolveId(id)
144151
if (entry) {
145152
resolved = true
153+
clearWarnTimer()
146154
entries.add(entry)
147155
return entry
148156
}
@@ -159,6 +167,9 @@ export function GlobalModeDevPlugin({ uno, tokens, tasks, flushTasks, affectedMo
159167
map: { mappings: '' },
160168
}
161169
},
170+
closeBundle() {
171+
clearWarnTimer()
172+
},
162173
},
163174
{
164175
name: 'unocss:global:post',

0 commit comments

Comments
 (0)