mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Report Babel transform errors without crashing the build process.
As reported by @mariusrak here: https://github.com/meteor/meteor/issues/10220#issuecomment-425244894 Only errors thrown by @babel/parser have the e.loc property. Other errors thrown by Babel transforms do not have e.loc, but do (usually) have line number information embedded in e.message. Either way, it's better to use inputFile.error than to throw the error, since throwing here crashes the build process.
This commit is contained in:
@@ -125,16 +125,19 @@ BCp.processOneFileForTarget = function (inputFile, source) {
|
||||
});
|
||||
} catch (e) {
|
||||
if (e.loc) {
|
||||
// Error is from @babel/parser.
|
||||
inputFile.error({
|
||||
message: e.message,
|
||||
line: e.loc.line,
|
||||
column: e.loc.column,
|
||||
});
|
||||
|
||||
return null;
|
||||
} else {
|
||||
// Error is from a Babel transform, with line/column information
|
||||
// embedded in e.message.
|
||||
inputFile.error(e);
|
||||
}
|
||||
|
||||
throw e;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isMeteorPre144) {
|
||||
|
||||
Reference in New Issue
Block a user