mirror of
https://github.com/status-im/metro.git
synced 2025-01-15 05:24:24 +00:00
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 = (
|
exports.minify = asyncify(
|
||||||
filename: string,
|
(filename: string, code: string, sourceMap: MappingsMap) => {
|
||||||
code: string,
|
|
||||||
sourceMap: MappingsMap,
|
|
||||||
callback: Callback<{code: string, map: MappingsMap}>,
|
|
||||||
) => {
|
|
||||||
var result;
|
var result;
|
||||||
try {
|
try {
|
||||||
result = minify.withSourceMap(code, sourceMap, filename);
|
result = minify.withSourceMap(code, sourceMap, filename);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
callback(error);
|
if (error.constructor.name === 'JS_Parse_Error') {
|
||||||
|
throw new Error(
|
||||||
|
error.message +
|
||||||
|
' in file "' +
|
||||||
|
filename +
|
||||||
|
'" at line ' +
|
||||||
|
error.line +
|
||||||
|
':' +
|
||||||
|
error.col,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
callback(null, result);
|
throw error;
|
||||||
};
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
exports.transformCode = transformCode; // for easier testing
|
exports.transformCode = transformCode; // for easier testing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user