feat: log more error

This commit is contained in:
RiESAEX 2022-12-28 02:17:58 +00:00
parent 0e05f23bc1
commit f5dddd7700

View File

@ -4,10 +4,16 @@ export async function build({ bundleConfig }) {
return new Promise((resolve, reject) => {
const compiler = webpack(bundleConfig);
compiler.run((err, stats) => {
if (err || stats.hasErrors()) {
if (err) {
console.error(err);
return reject(new Error('build failed'));
}
if (stats?.hasErrors()) {
stats.compilation.errors.forEach((e) => {
console.error(e);
});
return reject(new Error('build failed'));
}
resolve({ stats });
});
});