Skip to content

Commit

Permalink
misc(build): fix minifyFileTransform stream bug in Node 16 (#13073)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Sep 16, 2021
1 parent 6caacad commit 6b95928
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions build/build-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ function minifyFileTransform(file) {
code += chunk.toString();
next();
},
async final(next) {
try {
const result = await terser.minify(code, {ecma: 2019});

// TODO: when min is Node 16, can just make this function async.
final(next) {
terser.minify(code, {ecma: 2019}).then(result => {
if (result.code) {
const saved = code.length - result.code.length;
// eslint-disable-next-line no-console
Expand All @@ -43,11 +42,11 @@ function minifyFileTransform(file) {
}

next();
} catch (err) {
}).catch(err => {
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
}
});
},
});
}
Expand Down

0 comments on commit 6b95928

Please sign in to comment.