fix(babel-template): Fix Error in IE <= 9

In IE <= 9 Error.prototype.stack does not exist.
This commit is contained in:
Daniel Tschinder 2016-02-18 12:59:36 +01:00 committed by Daniel Tschinder
parent 26a3fdc3df
commit ec5d83f95d

View File

@ -18,7 +18,10 @@ export default function (code: string, opts?: Object): Function {
// error stack gets populated in IE only on throw (https://msdn.microsoft.com/en-us/library/hh699850(v=vs.94).aspx)
throw new Error();
} catch (error) {
stack = error.stack.split("\n").slice(1).join("\n");
if (error.stack) {
// error.stack does not exists in IE <= 9
stack = error.stack.split("\n").slice(1).join("\n");
}
}
let getAst = function () {