Error handling for transient sourcemap build failures

This commit is contained in:
yname 2024-08-19 16:40:30 -04:00
parent 7dcbd2130d
commit 133acb3e77

View file

@ -108,13 +108,17 @@ async function rebuild() {
} }
for (const root of SOURCE_ROOTS) { for (const root of SOURCE_ROOTS) {
fs.watch(root, { recursive: true }, (_, file) => { fs.watch(root, { recursive: true }, async (_, file) => {
if (file?.startsWith('.git/')) return if (file?.startsWith('.git/')) return
console.log( console.log(
`Detected change in ${root} -> ${file}; rebuilding sourcemap...`, `Detected change in ${root} -> ${file}; rebuilding sourcemap...`,
) )
sourcemapCache.delete(root) sourcemapCache.delete(root)
rebuild() try {
await rebuild()
} catch {
console.error('Failed to rebuild sourcemap.')
}
}) })
} }