From: Lior Chen Date: Mon, 3 Aug 2015 10:40:02 +0000 (+0300) Subject: verified 'require' is a function (on templates) X-Git-Tag: 2.11.0~56^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a08d17bb7f3f30892e282aca0114dfe6e07e5b8;p=thirdparty%2Fmoment.git verified 'require' is a function (on templates) Added a check to verify 'require' is a function, before assuming it exists. In some cases 'exports' and 'module' are defined even when the system is not using require. --- diff --git a/templates/locale-header.js b/templates/locale-header.js index f304506e6..8d0f24b43 100644 --- a/templates/locale-header.js +++ b/templates/locale-header.js @@ -1,5 +1,6 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) : + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['moment'], factory) : factory(global.moment) }(this, function (moment) { 'use strict'; diff --git a/templates/test-header.js b/templates/test-header.js index 38940c3ec..b46e225c7 100644 --- a/templates/test-header.js +++ b/templates/test-header.js @@ -1,5 +1,6 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../moment')) : + typeof exports === 'object' && typeof module !== 'undefined' + && typeof require === 'function' ? factory(require('../../moment')) : typeof define === 'function' && define.amd ? define(['../../moment'], factory) : factory(global.moment) }(this, function (moment) { 'use strict';