Add error log

This commit is contained in:
the1812 2022-05-21 16:23:23 +08:00
parent 46ee30204d
commit d480759f94

View File

@ -13,6 +13,20 @@ export const defaultWatcherHandler = (
if (result.hash === lastHash) {
return
}
const needLogging = result.hasErrors() || result.hasWarnings()
if (needLogging) {
console.log(result.toString({
hash: false,
assets: false,
modules: false,
chunks: false,
color: true,
}))
}
if (result.hasErrors()) {
lastHash = ''
return
}
if (!lastHash) {
initCallback(result)
}