diff --git a/packages/babel-helpers/src/helpers.ts b/packages/babel-helpers/src/helpers.ts index 6f101048e7c0..957e61e634c5 100644 --- a/packages/babel-helpers/src/helpers.ts +++ b/packages/babel-helpers/src/helpers.ts @@ -314,7 +314,12 @@ helpers.construct = helper("7.0.0-beta.0")` helpers.isNativeFunction = helper("7.0.0-beta.0")` export default function _isNativeFunction(fn) { // Note: This function returns "true" for core-js functions. - return Function.toString.call(fn).indexOf("[native code]") !== -1; + try { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } catch (e) { + // Firefox 31 throws when "toString" is applied to an HTMLElement + return typeof fn === "function"; + } } `;