Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc(build): fix minifyFileTransform stream bug in Node 16 #13073

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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