mirror of https://github.com/status-im/metro.git
Print proper error from uglify
Reviewed By: jeanlauliac Differential Revision: D5264809 fbshipit-source-id: 2a2c7c9af74e8c87acf68e2e9205c85b7aea2fb9
This commit is contained in:
parent
2a085f0c1b
commit
54c4aed3b4
|
@ -183,19 +183,27 @@ exports.transformAndExtractDependencies = (
|
|||
);
|
||||
};
|
||||
|
||||
exports.minify = (
|
||||
filename: string,
|
||||
code: string,
|
||||
sourceMap: MappingsMap,
|
||||
callback: Callback<{code: string, map: MappingsMap}>,
|
||||
) => {
|
||||
var result;
|
||||
try {
|
||||
result = minify.withSourceMap(code, sourceMap, filename);
|
||||
} catch (error) {
|
||||
callback(error);
|
||||
}
|
||||
callback(null, result);
|
||||
};
|
||||
exports.minify = asyncify(
|
||||
(filename: string, code: string, sourceMap: MappingsMap) => {
|
||||
var result;
|
||||
try {
|
||||
result = minify.withSourceMap(code, sourceMap, filename);
|
||||
} catch (error) {
|
||||
if (error.constructor.name === 'JS_Parse_Error') {
|
||||
throw new Error(
|
||||
error.message +
|
||||
' in file "' +
|
||||
filename +
|
||||
'" at line ' +
|
||||
error.line +
|
||||
':' +
|
||||
error.col,
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
);
|
||||
|
||||
exports.transformCode = transformCode; // for easier testing
|
||||
|
|
Loading…
Reference in New Issue