From ec5d83f95da726289ace4ce490cf86e315143f64 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Thu, 18 Feb 2016 12:59:36 +0100 Subject: [PATCH] fix(babel-template): Fix Error in IE <= 9 In IE <= 9 Error.prototype.stack does not exist. --- packages/babel-template/src/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/babel-template/src/index.js b/packages/babel-template/src/index.js index ef3cc93190..14c2286d23 100644 --- a/packages/babel-template/src/index.js +++ b/packages/babel-template/src/index.js @@ -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 () {