From c6e2dbbc5a93c052554c5eec000b47840752d3c6 Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Fri, 15 Jan 2021 22:25:59 +0300 Subject: [PATCH] webui: show the actual error when compressJs fails note that this does not show the correct error line b/c we filter this through the remover() first --- code/gulpfile.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/gulpfile.js b/code/gulpfile.js index b4257aef..c168f097 100644 --- a/code/gulpfile.js +++ b/code/gulpfile.js @@ -116,7 +116,12 @@ var compressJs = function() { } if (source.path.endsWith("custom.js")) { - var result = terser.minify(source.contents.toString()); + var contents = source.contents.toString(); + var result = terser.minify(contents); + if (result.error) { + var { message, filename, line, col, pos } = result.error; + throw new Error("terser error `" + message + "` in file " + filename + ", at line " + line); + } source.contents = Buffer.from(result.code); this.push(source);